Home
← All indicators

Market structure · Pine Script v6

Downloads —

CVD Divergence+

Plots an estimated cumulative volume delta (CVD) in its own pane and marks swing highs and lows where price and CVD disagree, on both the price chart and the CVD pane.

View on TradingView ↗Download .pine ↓
CVD Divergence+ chart example

Overview

CVD Divergence+ plots an estimated cumulative volume delta (CVD) in its own pane and marks swing highs and lows where price and CVD disagree. When price makes a higher high but CVD makes a lower high, the move up was not backed by the same net buying. When price makes a lower low but CVD makes a higher low, the move down was not backed by the same net selling. Each divergence is drawn on both the price chart and the CVD pane, and dropped once price moves past it.

How it works

Each 1 minute bar inside the chart bar counts all of its volume as buying if it closed above its open, and as selling if it closed below. The chart bar’s delta is the sum of those values, and CVD is the running total. It resets each trading day by default, with weekly and no reset also available. Where 1 minute history is not available, the chart bar itself is classified the same way, and the panel shows which source is in use. This is an estimate built from bar direction, not tick data, bid/ask volume or footprint data.

A swing high or low needs 5 bars on the left and 3 on the right, so it is only known once the 3 right-side bars have closed. Each new pivot is compared with the previous pivot of the same kind using CVD at the two pivot bars.

The two pivots must be within 80 bars, at least 4 ticks apart in price and at least 1.0x the 50 bar average of absolute bar delta apart in CVD. A divergence ends when price trades past its second pivot. In Minimal view it is removed; in Full view it stays, faded. Once a mark is printed it does not move, and everything is calculated on closed bars with no lookahead.

Features

How to use

Use it on futures or stock charts from 1 to 15 minutes, on symbols that report volume. A CVD- or CVD+ tag means delta did not confirm the new price extreme. The line on the CVD pane shows how far apart the two readings were, and a divergence that disappears or fades means price has already moved past it. Check the Data row in the panel: “chart bars” means 1 minute history is not available for that bar and the estimate is at its coarsest.

Alerts

CVD Divergence — Bearish and CVD Divergence — Bullish each fire once on the closed bar where a divergence is confirmed, which is 3 bars after the pivot with the default settings.

Limitations

Tips

This is a context tool, not financial advice and not a trading signal.

CVD Divergence+ source