OPEN-SOURCE SCRIPT
CVD Divergence

CVD Divergence highlights when price and Cumulative Volume Delta (CVD) disagree — a classic early warning that order-flow pressure is fading and a potential turning point may be forming.
How it works
The script builds a continuous CVD line by requesting lower-timeframe candles with request.security_lower_tf and summing their delta (up-volume minus down-volume) on every bar, without resetting per session. It then detects swing highs and lows (pivots) on the CVD line and compares each pivot to the previous one against the matching price pivot.
What it detects
- Regular Bullish — price makes a lower low while CVD makes a higher low (selling pressure fading).
- Regular Bearish — price makes a higher high while CVD makes a lower high (buying pressure fading).
- Hidden Bullish / Hidden Bearish — trend-continuation variants, off by default.
Each confirmed divergence is drawn as a line connecting the two CVD pivots, with a label (Bull / Bear / H Bull / H Bear). Four alert conditions are included so you can be notified automatically.
Settings
- Lower timeframe — resolution used to estimate delta (default 1 min).
- Pivot left / right length — swing sensitivity. Smaller values = more signals; larger = fewer but stronger.
- Min / Max pivot distance — allowed spacing between the two pivots being compared.
- Show Regular / Show Hidden — toggle each divergence family.
How to use
Treat divergences as context, not a standalone entry. They work best near support/resistance, prior highs/lows, or other confluence. Signals confirm only after the pivot's right-side bars complete, so they appear with an inherent delay and the latest swing may not be confirmed yet.
Notes & limitations
Standard chart data contains no true bid/ask tick information, so delta is approximated from lower-timeframe candle direction. Results are most reliable on liquid instruments with genuine volume (futures, crypto, major equities) and on intraday timeframes — on high timeframes the available lower-timeframe history is limited. For analysis and educational purposes only; not financial advice.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.