PROTECTED SOURCE SCRIPT

CVD 5 lines configurable

24
ENG:
CVD = Cumulative Volume Delta

Volume delta in this script is calculated as an approximation:

if the candle is bullish (close > open) → delta = +volume

if the candle is bearish (close < open) → delta = −volume

if it’s a doji (close == open) → delta = 0

Then the script creates a cumulative sum over time (ta.cum(delta)), meaning:

when buying pressure dominates → CVD rises

when selling pressure dominates → CVD falls

This is not “true” bid/ask delta (TradingView usually doesn’t have tape data), but a practical approximation based on candle direction and volume.

What the 5 lines represent

You have 5 lines in the panel:

Line 1: CVD (raw cumulative delta)

Line 2: MA on CVD (e.g. EMA 21)

Line 3: MA on CVD (e.g. EMA 50)

Line 4: MA on CVD (e.g. EMA 200)

Line 5: MA on CVD (custom, e.g. 100)

For lines 2–5 you can set:

MA type: EMA / SMA / RMA / WMA

length

color

line width

visibility (on/off)

How to read it in practice

CVD above its MAs → buying dominance (demand momentum)

CVD below its MAs → selling dominance (supply momentum)

CVD crossing an MA or shorter MA crossing a longer MA → change in demand/supply momentum

the longer the MA (e.g. 200), the more it reflects the background / volume trend

Divergences: what the ^ and v markers mean

The script detects regular divergences between price and CVD at pivots (local highs/lows).

Pivots mean the signal appears with a delay of pLen candles (this is normal).

Bullish divergence ( ^ marker )

price makes a lower low (LL)

CVD makes a higher low (HL)

➡️ suggests that despite price falling, selling pressure is weakening / accumulation is occurring → potential bounce.

Bearish divergence ( v marker )

price makes a higher high (HH)

CVD makes a lower high (LH)

➡️ suggests that despite price rising, buying pressure is weakening / distribution → potential pullback or drop.

What this is used for

Trend confirmation: whether moves have real volume “fuel”

Early warnings: divergences often appear before price reversals

Entry filters: e.g. only take LONGs when CVD > MA(200), or when after a divergence CVD breaks above MA(21)

Most important limitation

CVD here is an approximation (based on candle direction).
On some instruments / timeframes it works very well, on others less so — therefore it’s best used as a confirmation tool, not a standalone signal.

Personally recommended settings

EMA 8

EMA 34

EMA 50

EMA 200

I do not use divergence markers personally, although that may simply mean I haven’t found the right settings yet.

Simple cheat sheet (remember this)
Price CDV What it means Bias
↑ ↑ real buying LONG
↓ ↓ real selling SHORT
↑ ↓ distribution SHORT soon
↓ ↑ accumulation LONG soon

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.