OPEN-SOURCE SCRIPT
Cumulative Volume Delta with Divergence

🧠 Core Functionality:
1. Cumulative Volume Delta (CVD):
Purpose: Visualizes the difference between buying and selling pressure over time.
Mechanism:
It uses lower-timeframe volume delta data, retrieved from ta.requestVolumeDelta(), to build a candle-style visualization of the net volume movement.
Plotted candles show whether buying (up volume) or selling (down volume) was dominant within each period.
Teal candles: More buying than selling (CVD up).
Red candles: More selling than buying (CVD down).
Volume Source: Based on intrabar up/down volume approximation from lower timeframes.
🧭 Divergence Detection (New Feature):
2. Regular Bullish Divergence:
Condition:
Price makes a lower low.
CVD (lastVolume) makes a higher low.
Interpretation: Selling pressure is weakening despite price making new lows — a potential reversal signal to the upside.
Displayed As:
Green line and label "Bull" under the CVD at the divergence point.
3. Regular Bearish Divergence:
Condition:
Price makes a higher high.
CVD makes a lower high.
Interpretation: Buying pressure is fading despite price rising — a potential reversal signal to the downside.
Displayed As:
Red line and label "Bear" above the CVD at the divergence point.
🧰 User Controls:
Use custom timeframe: Overrides default volume delta resolution for finer or broader analysis.
Calculate Divergence: Turns the divergence detection on or off.
Adjustable via script inputs.
🔔 Alerts:
Two alert conditions are included:
One for bullish divergence.
One for bearish divergence.
Alerts trigger at the bar where the divergence is confirmed, not where it starts.
📈 Use Case:
This tool is ideal for traders looking to:
Spot early reversals or momentum shifts.
Combine volume analysis with price action.
Time entries or exits more accurately using volume-confirmed divergence.
1. Cumulative Volume Delta (CVD):
Purpose: Visualizes the difference between buying and selling pressure over time.
Mechanism:
It uses lower-timeframe volume delta data, retrieved from ta.requestVolumeDelta(), to build a candle-style visualization of the net volume movement.
Plotted candles show whether buying (up volume) or selling (down volume) was dominant within each period.
Teal candles: More buying than selling (CVD up).
Red candles: More selling than buying (CVD down).
Volume Source: Based on intrabar up/down volume approximation from lower timeframes.
🧭 Divergence Detection (New Feature):
2. Regular Bullish Divergence:
Condition:
Price makes a lower low.
CVD (lastVolume) makes a higher low.
Interpretation: Selling pressure is weakening despite price making new lows — a potential reversal signal to the upside.
Displayed As:
Green line and label "Bull" under the CVD at the divergence point.
3. Regular Bearish Divergence:
Condition:
Price makes a higher high.
CVD makes a lower high.
Interpretation: Buying pressure is fading despite price rising — a potential reversal signal to the downside.
Displayed As:
Red line and label "Bear" above the CVD at the divergence point.
🧰 User Controls:
Use custom timeframe: Overrides default volume delta resolution for finer or broader analysis.
Calculate Divergence: Turns the divergence detection on or off.
Adjustable via script inputs.
🔔 Alerts:
Two alert conditions are included:
One for bullish divergence.
One for bearish divergence.
Alerts trigger at the bar where the divergence is confirmed, not where it starts.
📈 Use Case:
This tool is ideal for traders looking to:
Spot early reversals or momentum shifts.
Combine volume analysis with price action.
Time entries or exits more accurately using volume-confirmed divergence.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.