TradingView indicator calculations

Cumulative volume delta: check the reset before the divergence

Cumulative volume delta (CVD) adds signed volume estimates across chart bars until an anchor reset. TradingView infers each intrabar volume sign from price direction; this is not exchange-reported aggressor trade data. Check the lower timeframe, reset boundaries and confirmation time before comparing two readings or recording a divergence.

See the decision guide

Assign the intrabar sign, then sum the bar delta

TradingView documents this classification for its Volume Delta indicator: a close above the intrabar open gives positive volume; below gives negative volume. For equal open and close, compare with the preceding intrabar close. If that is also equal, carry forward the previous sign. Bar delta is the sum of those signed volumes.

  • The volume delta indicator starts each chart bar at zero. CVD carries the accumulated result between bars in the same anchor period.
  • An entire intrabar receives one sign. Trades in both directions can occur inside it, so the label cannot identify the initiating side of each trade.

Recalculate nine intrabars by hand

This invented fixture uses three-minute chart bars and one-minute intrabars. Prices are arbitrary; volumes are shares. A and B are the only Monday chart bars; C is the first Tuesday bar in the same week. Assume no omitted trading bars or missing volume. Both daily and weekly periods start at A, and the daily period restarts at C. These deliberately short sessions isolate the arithmetic.

  • A has 100 positive shares and 100 negative shares: delta = 0 despite total volume of 200. B has 150 positive and 50 negative: delta = +100. C has 30 positive and 100 negative: delta = −70.
  • B / 2 is flat but positive because its close is above the previous close. A / 3 and C / 2 retain a negative sign. Assigning zero to every flat intrabar would change this fixture.
  • The example begins with a directional intrabar, so its initial sign is known. A custom implementation must state what happens when its first available intrabar is flat and has no prior sign.
Chart bar / intrabarOpen → closeVolumeSign reasonSigned volumeRunning bar delta
A / 1100 → 101100Close > open+100100
A / 2101 → 10060Close < open−6040
A / 3100 → 10040Equal previous close; retain −−400
B / 1100 → 101120Close > open+120120
B / 2102 → 10230Flat; close > previous 101+30150
B / 3102 → 10150Close < open−50100
C / 1101 → 10080Close < open−80−80
C / 2100 → 10020Equal previous close; retain −−20−100
C / 3100 → 10130Close > open+30−70

Compare daily and weekly anchor results

Within an anchor, CVD close = previous CVD close + bar delta. At a new anchor, use zero instead of the previous close. A CVD candle opens at that starting value; its high and low track the cumulative path during the bar. The following values include the opening point in that path.

  • For C, the daily path is 0 → −80 → −100 → −70. The weekly path is 100 → 20 → 0 → 30. A positive weekly close of 30 can coexist with a negative current-bar delta of −70.
  • Changing the anchor does not change the signed intrabars in this fixture. It changes which earlier deltas remain in the total.
  • On your chart, inspect the first bar after the chosen anchor changes. Confirm the actual period boundary for that symbol and session; do not assume every daily reset means the stock-market cash open.
BarBar deltaDaily CVD O / H / L / CWeekly CVD O / H / L / C
Monday A00 / 100 / 0 / 00 / 100 / 0 / 0
Monday B+1000 / 150 / 0 / 1000 / 150 / 0 / 100
Tuesday C−700 / 0 / −100 / −70100 / 100 / 0 / 30

Separate anchor length from historical coverage

TradingView describes a tradeoff: finer intrabars preserve more price-path detail but cover fewer chart bars. Coarser intrabars extend coverage and can change the signed-volume estimate. Anchor length controls accumulation; it cannot restore unavailable intrabars. Measure the first usable timestamp for each configuration on your own chart.

  • The 12,000-intrabar budget is an arithmetic assumption, not a TradingView plan limit or measured history. It assumes complete 60-minute chart bars: 12,000 / 60 = 200 and 12,000 / 12 = 1,000. Sessions, gaps and feed availability change real coverage.
  • For a comparison log, record configuration, first available CVD timestamp, first complete anchor, and the same completed-bar close under each setup. Exclude a partial first anchor from cross-configuration comparisons.
  • If the available history begins partway through a week, a weekly total cannot be verified from the weekly boundary. Shortening the anchor may yield a later complete period, but does not repair the earlier missing data.
Illustrative setupIntrabars per hourly barCoverage with assumed 12,000 intrabarsWhat resets
1-minute intrabars; daily anchor60200 hourly barsDaily total
5-minute intrabars; daily anchor121,000 hourly barsDaily total
1-minute intrabars; weekly anchor60200 hourly barsWeekly total
5-minute intrabars; weekly anchor121,000 hourly barsWeekly total

Record a divergence when it becomes knowable

Use a declared rule before inspecting the result. This hypothetical bearish-divergence rule compares CVD closes sampled at two confirmed price swing highs within one anchor. A swing high must exceed the highs of two bars on each side. Equality fails the rule. Require the second price high to be higher and its sampled CVD close to be lower.

  • Assume highs for bars 8 through 15 are 97, 99, 100, 98, 99, 102, 101, 100. Both pivots satisfy the strict two-bars-each-side test. The sampled CVD values are separate assumed inputs, not values calculated from those price highs.
  • At bar 15 close, 102 > 100 and 300 < 400 confirm this defined divergence. Log the event at bar 15. A line drawn back to bar 13 must not imply that the event was available there.
  • If bar 14 or 15 reaches 102 or higher, bar 13 fails this strict pivot test. If an anchor reset or missing CVD separates the pivots, discard the comparison under this rule.
  • This rule samples CVD at price pivots; it does not require independent CVD pivots. A different pairing rule can produce different signals. Divergence alone specifies neither an entry price nor an exit, and a trend can continue after it.
Price pivotPrice highCVD close at pivotEarliest confirmation
Bar 10100400Close of bar 12
Bar 13102300Close of bar 15

Verify values before asking for an alert

Add the built-in Cumulative Volume Delta indicator in TradingView. Fix the symbol, chart interval and session; choose the Anchor period and an explicit custom lower timeframe. Record completed-bar values around a reset and a flat intrabar before testing divergence. A live value may change before the chart bar closes.

  • Give the Pine Script AI Coding Agent the sign convention, lower timeframe, reset boundary and missing-data policy. Request visible bar delta, CVD close and anchor identifier so discrepancies can be located.
  • For the example divergence, request two confirmed price pivots in the same complete anchor, CVD sampled at their timestamps, and an event only at the second pivot confirmation close. Keep pivot time and confirmation time as separate outputs.
  • Ask for syntax checking, then compare the generated calculation with TradingView on matching timestamps. Syntax success does not prove numerical agreement, data completeness or profitable signals.
  • If volume is unavailable, treat the result as unavailable. A zero-volume observation and an absent observation are different. Do not bridge a missing period with an assumed zero delta.
Where Pineify fits

Pine Script AI Coding Agent

Turn a documented CVD calculation and confirmation rule into a Pine Script draft. Inspect the source, request syntax checking, and compare intermediate values before enabling alerts.

Draft a CVD rule in Pine

Frequently asked questions

Educational information, not investment advice. All numerical examples are hypothetical. CVD estimates, divergence conditions and syntax checks do not establish trading performance or guarantee future returns.

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.