Picture of the author

TradingView-RU

06/21 22:00

CVD Delta Divergence [JOAT]

CVD DELTA DIVERGENCE

A full-featured Cumulative Volume Delta engine with proper pivot-based divergence detection. CVD on its own is one of the cleanest reads of net flow you can produce without L2 data — but the value of CVD lives almost entirely in its divergence with price. CVD Delta Divergence builds the CVD properly (with footprint-API or reconstructed-tick options), then runs a strict pivot-vs-pivot divergence engine on top of it, with strength scoring and configurable cooldown.



Three data-source modes

CVD is only as good as the delta classification underneath it. Three modes are exposed:


Footprint API — uses TradingView's Footprint dataset when the instrument supports it. The cleanest read, equivalent to professional delta feeds.
Reconstructed — when Footprint is unavailable, reconstructs buy/sell from a configurable lower-timeframe stream (1m / 3m / 5m / 15m / 30m) using the standard tick rule. Optional intrabar volume weighting.
Auto — picks Footprint when present, falls back to Reconstructed. The recommended default.


This is unusual — most public CVD scripts hardcode one method. Auto-mode means the script works correctly on any instrument that has either dataset, without per-instrument configuration.

Four CVD anchors

Cumulative deltas need an anchor — running a sum from inception of data is rarely meaningful. Four anchoring modes:


Cumulative — never resets. Maximum context, slowest divergence detection.
Session Reset (default) — anchors at the start of each trading session. The most useful read for day-trading reference.
Day Reset — anchors at midnight exchange time.
Week Reset — anchors at week boundary. Good for swing-frame divergences.


Pivot-based divergence engine (the headline)

Slope-comparison divergence is noisy. CVD Delta Divergence uses proper pivots :


ta.pivothigh / ta.pivotlow on price with a configurable lookback (default 5 bars left/right).
At each confirmed pivot, the corresponding CVD value is recorded.
A divergence is built only when two price pivots and their CVD readings disagree directionally.
A minimum-strength filter (default 15.0 on a 0–100 scale) suppresses weak signals — strength is the normalised disagreement magnitude between the price-pivot motion and the CVD-pivot motion.
A strict HL/LL toggle requires the second pivot to strictly exceed/undershoot the first by a small fraction so equal-pivot edge cases do not produce noise divergences.
A cooldown per divergence class (default 3 bars) prevents back-to-back fires of the same class.


Four divergence classes are detected:


Regular Bull — price lower-low, CVD higher-low. Reversal up.
Regular Bear — price higher-high, CVD lower-high. Reversal down.
Hidden Bull — price higher-low, CVD lower-low. Trend continuation up.
Hidden Bear — price lower-high, CVD higher-high. Trend continuation down.


Divergence markers can be force-overlaid onto the main chart pane (toggleable) so you see them on price without flipping panes.

Visual system


Slope-coloured CVD line — bull / bear gradient based on the CVD's own short-term slope (configurable window).
Smoothed CVD overlay — toggleable EMA-smoothed CVD on top of the raw line. Useful for cutting through noisy 1m reconstructions.
Delta histogram — bar-by-bar delta as columns behind the CVD line. Useful for seeing per-bar flow vs cumulative flow.
Zero line and crossover alerts.
Divergence connecting lines — when a divergence fires, a connector line is drawn between the two pivots for visual proof.


A locked Lava palette (gold bull / orange-red bear / oxblood mid on a deep lava-black ground) gives the pane a distinctive flow-read identity.



Dashboard

Monospaced table, positionable to any of eight corners, with:


Current CVD value with sign.
CVD slope direction (Rising / Falling / Flat).
Active anchor mode.
Last divergence class with bar age.
Source mode in use (Footprint / Reconstructed).
Zero-cross status with bars-ago.


Alerts

Six alert conditions, each independently controllable:


Regular Bull Divergence
Regular Bear Divergence
Hidden Bull Divergence
Hidden Bear Divergence
CVD Crosses Zero
CVD Slope Flips


How to read it

Three reads, in order of conviction:


Regular divergence — the classic reversal read. Price made a new extreme, CVD did not. The flow that was needed to extend the move did not show up. A regular divergence at a known structural level is one of the highest-conviction reversal setups in tape reading.
Hidden divergence — the trend-continuation read. Price retraced, but CVD did not. The flow is still committed in the original direction even though price wavered. Often produces clean re-entry signals in trends.
CVD zero-cross + slope flip — the regime change read. Cumulative flow has rotated sides — what was net-buying is now net-selling (or vice versa). Useful as a "the tape has flipped" notification.


Suggested settings

Defaults are tuned for 5m–1H charts on liquid markets in Session Reset mode. For lower timeframes, drop pivot lookback to 3 and divergence window to 30. For higher timeframes, raise pivot lookback to 7–10 and switch anchor to Day Reset. The minimum strength threshold (15) is intentionally loose; raise to 25–30 if you want only the strongest divergences.

Originality / what's reused

CVD (cumulative volume delta) is public-domain market-structure language; the tick rule is standard. The implementation — the Auto/Footprint/Reconstructed source switch, the four-anchor reset logic, the pivot-based divergence engine with strict HL/LL gating and minimum-strength filter, the slope-coloured CVD with histogram backdrop, the force-overlay divergence markers, and the cooldown-per-class state machine — is JOAT-original and tuned together. No third-party code reused.

Open source

Published open-source under the default Mozilla Public License 2.0. The source is sectioned, every input has a tooltip, every helper is documented inline. The CVD engine, the source-mode router, the pivot logic, and the divergence engine are independent modules — adapt any single piece without reading the whole file.

Limitations

Reconstructed CVD is a proxy — the tick rule is the accepted public-market inference but it is not a direct read of bid vs ask volume. Footprint mode requires the TradingView Footprint dataset and is unavailable on some instruments. Pivot divergences are non-repainting once confirmed (they lag by the pivot's right-lookback) but the divergence between two pivots cannot fire until both are confirmed — so the second pivot's lag is the structural lag of the signal.



-made with passion by jackofalltrades
#HTX Invites You to Share 600K USDT in Gift Packs#World Cup Predictions: 100,000 USDT Daily#BTC Prophet: 20-Day 380 Million HTX Challenge
ЛайкПоделиться

Все комментарии0НовыеВ тренде

avatar
НовыеВ тренде