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.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.