OPEN-SOURCE SCRIPT
Cumulative Volume Delta

📊 Indicator Name:
Cumulative Volume Delta (CVD) + Candle Divergence (Color DIfference)
📌 Purpose:
This indicator visualizes volume delta over a user-defined time anchor and highlights divergence between volume-based momentum and price movement. It's especially useful for identifying potential reversals, fakeouts, or hidden buying/selling pressure.
🔍 How It Works:
1. Volume Delta Calculation (CVD Candles):
The script uses ta.requestVolumeDelta() to approximate volume delta data over a chosen anchor period (e.g., 1D).
Volume delta = Buy Volume – Sell Volume
Each candle on the CVD chart represents changes in cumulative volume delta, with OHLC-style values:
openVolume: cumulative delta at the start of the bar
lastVolume: cumulative delta at the end of the bar
maxVolume, minVolume: intra-bar high and low
2. Visual Representation (CVD Candles):
Green/Teal candle: Delta is increasing (buying pressure dominates)
Red candle: Delta is decreasing (selling pressure dominates)
3. Divergence Detection:
The script compares the direction of the price candle with the direction of the CVD candle:
Price Up + CVD Down → Possible hidden selling (bearish divergence)
Price Down + CVD Up → Possible hidden buying (bullish divergence)
4. Color Highlighting:
Orange candle on the CVD chart signals divergence between price and volume delta.
This color override helps you quickly spot potential discrepancies between price movement and underlying volume pressure.
5. Alerting:
An alertcondition is added so you can receive a notification whenever a divergence occurs.
⚙️ User Inputs:
Anchor period (e.g., 1D): Timeframe over which the CVD is anchored.
Use custom timeframe: Allows you to override and define the internal lower timeframe used for volume estimation (e.g., 1-min).
📈 How to Use It:
✅ Bullish Divergence (Price down, CVD up)
This may indicate:
Buyers absorbing selling pressure.
A potential reversal to the upside.
Hidden accumulation.
🚫 Bearish Divergence (Price up, CVD down)
This may indicate:
Sellers stepping in despite upward price.
A potential reversal to the downside.
Hidden distribution.
🧠 Trading Insights:
CVD is often used by order flow traders or those analyzing market depth and volume imbalances.
This version lets you visually align price action with underlying volume, improving decision-making.
The divergence signal can be combined with other technical tools like support/resistance, candlestick patterns, or trendlines for confirmation.
Cumulative Volume Delta (CVD) + Candle Divergence (Color DIfference)
📌 Purpose:
This indicator visualizes volume delta over a user-defined time anchor and highlights divergence between volume-based momentum and price movement. It's especially useful for identifying potential reversals, fakeouts, or hidden buying/selling pressure.
🔍 How It Works:
1. Volume Delta Calculation (CVD Candles):
The script uses ta.requestVolumeDelta() to approximate volume delta data over a chosen anchor period (e.g., 1D).
Volume delta = Buy Volume – Sell Volume
Each candle on the CVD chart represents changes in cumulative volume delta, with OHLC-style values:
openVolume: cumulative delta at the start of the bar
lastVolume: cumulative delta at the end of the bar
maxVolume, minVolume: intra-bar high and low
2. Visual Representation (CVD Candles):
Green/Teal candle: Delta is increasing (buying pressure dominates)
Red candle: Delta is decreasing (selling pressure dominates)
3. Divergence Detection:
The script compares the direction of the price candle with the direction of the CVD candle:
Price Up + CVD Down → Possible hidden selling (bearish divergence)
Price Down + CVD Up → Possible hidden buying (bullish divergence)
4. Color Highlighting:
Orange candle on the CVD chart signals divergence between price and volume delta.
This color override helps you quickly spot potential discrepancies between price movement and underlying volume pressure.
5. Alerting:
An alertcondition is added so you can receive a notification whenever a divergence occurs.
⚙️ User Inputs:
Anchor period (e.g., 1D): Timeframe over which the CVD is anchored.
Use custom timeframe: Allows you to override and define the internal lower timeframe used for volume estimation (e.g., 1-min).
📈 How to Use It:
✅ Bullish Divergence (Price down, CVD up)
This may indicate:
Buyers absorbing selling pressure.
A potential reversal to the upside.
Hidden accumulation.
🚫 Bearish Divergence (Price up, CVD down)
This may indicate:
Sellers stepping in despite upward price.
A potential reversal to the downside.
Hidden distribution.
🧠 Trading Insights:
CVD is often used by order flow traders or those analyzing market depth and volume imbalances.
This version lets you visually align price action with underlying volume, improving decision-making.
The divergence signal can be combined with other technical tools like support/resistance, candlestick patterns, or trendlines for confirmation.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının oluşturucusu bunu açık kaynaklı hale getirmiştir, böylece yatırımcılar betiğin işlevselliğini inceleyip doğrulayabilir. Yazara saygı! Ücretsiz olarak kullanabilirsiniz, ancak kodu yeniden yayınlamanın Site Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının oluşturucusu bunu açık kaynaklı hale getirmiştir, böylece yatırımcılar betiğin işlevselliğini inceleyip doğrulayabilir. Yazara saygı! Ücretsiz olarak kullanabilirsiniz, ancak kodu yeniden yayınlamanın Site Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.