TradingView volume calculations

Net volume indicator: define the sign before adding volume

A net volume indicator subtracts volume classified as down from volume classified as up. A signed-bar version assigns each chart bar its whole volume with a positive, negative or zero sign. The price comparison defines that sign. This page provides explicit close-versus-open and close-versus-previous-close variants; neither measures the initiating side of individual trades.

See the decision guide

What the official Net Volume description establishes

TradingView describes Net Volume using uptick and downtick volume and associates a positive value with the upward category exceeding the downward category. Its help article does not specify close versus open, close versus previous close, or a flat-bar algorithm. The English summary also reverses the subtraction wording. Use the positive-up convention here, but do not treat this article alone as a specification of the built-in source.

  • The code below is an explicit custom signed-bar implementation. It is not presented as a verified replica of TradingView Net Volume.
  • When comparing another script, inspect its formula. Community scripts with the same name can use candle position, price changes or intrabar estimates and produce different values.

Choose close versus open or the previous close

For a reference price R, signed volume is +V when C > R, −V when C < R, and 0 when C = R. C is the current close and V is the current bar volume. This page deliberately assigns equality zero in both variants. It does not carry a preceding sign forward.

  • A doji at 105 after a previous close of 103 has zero body-signed volume but positive previous-close-signed volume. Candle color settings are not a substitute for specifying the comparison.
  • If a required reference or volume is missing, the value is unavailable. A reported volume of zero produces zero when the price inputs exist. A nonzero-volume flat bar also produces zero under this chosen equality rule.
RuleReference RWhat the sign answers
Close vs open (default)Current bar openDid price rise or fall inside this candle body?
Close vs previous closePrevious chart bar closeDid the close rise or fall relative to the preceding close?
Gap example: previous close 103, open 105, close 104, volume 60105 or 103Body rule: −60; previous-close rule: +60

Recalculate six one-minute bars

These are invented standard OHLCV bars, with volume in shares. Assume all six are available, A is the declared starting bar, and the preceding close before A is 100. The cumulative column uses the default body rule, begins at zero before A and does not reset within the table.

  • Body-signed total: 100 − 300 + 100 + 0 − 60 + 0 = −160. Previous-close-signed total: 100 − 300 + 100 + 0 + 60 + 0 = −40. Total reported volume is 600 in either case.
  • The 40 shares in D remain part of total volume even though the chosen sign rule assigns them zero. Zero signed volume does not establish an absence of trading or a balance of aggressive buyers and sellers.
BarOpen / high / low / closeVolumeBody signedPrevious-close signedBody cumulative
A100 / 103 / 99 / 102100+100+100100
B102 / 103 / 100 / 101300−300−300−200
C101 / 104 / 101 / 103100+100+100−100
D103 / 104 / 102 / 1034000−100
E105 / 106 / 104 / 10460−60+60−160
F104 / 104 / 104 / 104000−160

Aggregate the same data and the sign can reverse

Combine A, B and C into one three-minute candle: take the first open, maximum high, minimum low, last close and sum of volumes. The result is O=100, H=104, L=99, C=103, V=500. The body is positive, so the coarse signed value is +500. Summing the original one-minute body-signed values instead gives −100.

  • The coarse OHLCV candle preserves total volume but loses which smaller price moves carried it. High and low do not recover that allocation. Signing a volume sum and summing signed volumes are different operations.
  • The three-minute value overstates this particular one-minute signed sum by 600 shares. That difference is a fixture result, not a fixed correction factor or an empirical error rate.
  • Even a one-minute sign labels an entire minute. Mixed trade directions within that minute remain unknown from OHLCV alone.
Same underlying observationsCalculationSigned volume
A, B, C individually+100 − 300 + 100−100 shares
A through C as one three-minute barsign(103 − 100) × 500+500 shares
A through F as one six-minute barsign(104 − 100) × 600+600 shares
A through F individually+100 − 300 + 100 + 0 − 60 + 0−160 shares

A cumulative total needs a start and a missing-data policy

Without resets, T begins at zero immediately before the first included bar and each valid signed value is added. If A is first, the total after F is −160. If D is first, it is −60. These baselines answer different questions. A visible-history start is not necessarily the start of a trading session.

  • The script includes bars whose opening time is at or after the selected timestamp. If that timestamp falls inside a candle, the candle is excluded. If available history begins later, the calculation starts at the first available qualifying bar and is only a partial history.
  • The optional reset clears the total before the first bar of each new exchange daily period. It is intended for intraday charts; on daily or higher charts, daily-period changes generally reset on each bar. This is not a configurable cash-session-open reset.
  • If D begins a new daily period, resetting before D gives 0, −60, −60 for D, E and F. Earlier A through C values do not enter that daily total.
  • A missing volume or reference makes that bar unavailable. This implementation marks the cumulative total unavailable through the rest of the current accumulation period; a later daily reset can recover. With daily resets off, the user must choose a later valid starting time. Missing values are never silently added as zero.
  • Bars omitted entirely by the feed cannot be detected by this simple script. Its completeness flag only checks data on delivered bars. Compare feed, session, interval and available history separately.

Use a complete Pine Script v6 implementation

Paste this code into the Pine Editor and add it to a standard candle chart. Select the direction rule and start timestamp. Per-bar mode is the default; enable cumulative mode to see the running sum. Only confirmed chart bars are plotted, so an open real-time bar stays blank until it closes.

  • The cumulative accumulator updates once on each confirmed chart bar, rather than repeatedly adding the live bar volume on every tick. An orange background marks an unavailable selected calculation.
  • In previous-close mode, the reference may come from the bar before the chosen start or daily reset. Resetting the accumulator does not reset the price reference. If the first loaded bar has no preceding close, its value is unavailable and the strict cumulative policy applies.
  • Use the Data Window to compare completed timestamps. Record the symbol and feed, regular or extended session, chart interval, direction rule, start timestamp and daily-reset setting with the result.
Custom signed chart-bar volume. Flat comparison = zero; missing input invalidates the cumulative period. No lower-timeframe requests or trade-side data are used.pine
//@version=6
indicator("Signed bar volume: explicit rules", format=format.volume)
basis = input.string("Close vs open", "Direction", options=["Close vs open", "Close vs previous close"])
startTime = input.time(timestamp("01 Jan 2025 00:00 +0000"), "First included bar opening time")
resetDaily = input.bool(false, "Reset on exchange daily period")
showCumulative = input.bool(false, "Show cumulative instead of per-bar")

bool active = time >= startTime
bool dailyBoundary = timeframe.change("1D")
bool reset = active and (barstate.isfirst or not active[1] or (resetDaily and dailyBoundary))
float referencePrice = basis == "Close vs open" ? open : close[1]
bool valid = not na(close) and not na(referencePrice) and not na(volume) and volume >= 0
float signedVolume = valid ? (close > referencePrice ? volume : close < referencePrice ? -volume : 0.0) : na

var float total = 0.0
var bool complete = true
if reset
    total := 0.0
    complete := true
if active and barstate.isconfirmed
    if valid
        total += signedVolume
    else
        complete := false

float barValue = active and barstate.isconfirmed ? signedVolume : na
float cumulativeValue = active and barstate.isconfirmed and complete ? total : na
float value = showCumulative ? cumulativeValue : barValue
plot(value, "Signed volume", color=value >= 0 ? color.teal : color.red, style=plot.style_histogram)
hline(0, "Zero", color=color.gray)
bgcolor(active and barstate.isconfirmed and (not valid or (showCumulative and not complete)) ? color.new(color.orange, 85) : na, title="Unavailable calculation")

Keep this measure separate from Volume Delta and CVD

TradingView Volume Delta classifies lower-timeframe bars within each chart bar. It starts with close versus open; on equality it checks the previous intrabar close, then retains the preceding sign if prices remain equal. TradingView CVD accumulates those intrabar-derived deltas across an anchor period. This page assigns one sign per chart bar and uses zero for equality, so its cumulative line is not that CVD calculation.

  • A finer interval can preserve more price-path detail, but price-signed volume still estimates direction. It does not identify the actual aggressor of every execution.
  • Volume units depend on the feed. Check whether the data represents shares, contracts, base/quote volume or tick activity before comparing magnitudes across symbols. Missing volume cannot support a net-volume conclusion.
  • A positive bar or rising cumulative line is a calculated observation. It does not specify a trade, a reversal probability or a profitable threshold.

Give Pineify the exact rule to extend

The Pine Script AI Coding Agent can draft and revise Pine Script from written requirements. Supply the direction comparison, equality rule, start/reset policy and missing-data behavior with the six-bar fixture. Ask it to expose per-bar and cumulative values so you can compare the intermediate calculations.

  • If you need a session-specific reset or a lower-timeframe sum, describe that as a different calculation and verify it against matching timestamps. Do not rename the existing chart-bar cumulative total as CVD.
  • Request syntax checking after edits, then repeat the arithmetic checks. Syntax validation confirms compiler acceptance; it does not prove agreement with an external indicator or trading usefulness.
Where Pineify fits

Pine Script AI Coding Agent

Draft a signed-volume indicator from an explicit formula, then inspect its Pine source and compare the output with a calculation fixture.

Draft a signed-volume rule

Frequently asked questions

Educational calculations, not investment advice. All example OHLCV values are hypothetical. Price-signed volume does not establish trade aggressor identity, forecast accuracy or a profitable trading rule.

Sources and verification

Published by Pineify. Pineify is an independent product and is not affiliated with TradingView. Sources support the technical explanations; examples do not establish trading performance.