OPEN-SOURCE SCRIPT
Z-Score Volume with CVD Clustering

Script Title:
Z-Score Volume with CVD Clustering & NY VWAP
📘 Description:
This indicator combines statistical volume analysis with order flow confirmation to detect high-probability trade zones and volume-based divergences.
📌 Components:
Z-Score of Volume: Identifies statistically significant volume surges or drops relative to a moving average baseline.
Cumulative Volume Delta (CVD): Gauges net buying vs. selling pressure using high-frequency bid/ask delta.
K-Means Clustering: Applies clustering logic to classify each bar into:
Cluster 2 – Strong Bullish: Z-Score and CVD both strong
Cluster 1 – Divergence / Bull Trap: Z-Score high, but weak CVD
Cluster 0 – Neutral / Noise: No clear alignment
Anchored VWAP (NY Session Open): Confirms market structure and institutional trend bias from 9:30 AM ET forward.
🎯 Suggested Applications:
✅ 1. Trend Continuation Entries (Add-ons):
Look to add to positions when:
Cluster 2 signal occurs
Price is above the NY session VWAP
Price structure has broken out of prior day high/low or range
⚠️ 2. Divergence Detection (Fade Traps):
Cluster 1 signals a bearish divergence (e.g., high volume but weak CVD).
Especially useful when price is failing to stay above VWAP.
Useful for early exits or reversal setups.
📊 3. Volume Profile Confirmation:
Combine with fixed or session-based volume profile tools.
Use Z-Score clusters to confirm volume spikes into low-volume nodes (LVNs) or during imbalance transitions.
📍 4. VWAP Structure Confirmation:
Anchored VWAP acts as a dynamic reference point.
Helps confirm acceptance vs. rejection zones at key institutional levels.
📈 Visuals & Alerts:
Color-coded volume bars show intensity of Z-Score & CVD confluence
CVD Line plots real-time delta bias with green/red coloring
Cluster-based shape markers highlight key bars for actionable signals
Optional: Add alerts for Cluster 2 above VWAP or Cluster 1 below VWAP
⚙️ Customization Options:
Adjustable Z-Score length
Custom anchor timeframe for CVD (e.g., 1D or sessions)
Adjustable max lookback depth
Toggle VWAP inclusion
Extendable to include additional filters: RSI, structure break alerts, etc.
🔧 Ideal Use Cases:
NY session intraday traders (ES, NQ, CL, 6E, FX pairs)
Breakout traders wanting order flow confirmation
Mean reversion traders spotting fake moves
Volume-based scalpers looking for edge on short-term order imbalance
Z-Score Volume with CVD Clustering & NY VWAP
📘 Description:
This indicator combines statistical volume analysis with order flow confirmation to detect high-probability trade zones and volume-based divergences.
📌 Components:
Z-Score of Volume: Identifies statistically significant volume surges or drops relative to a moving average baseline.
Cumulative Volume Delta (CVD): Gauges net buying vs. selling pressure using high-frequency bid/ask delta.
K-Means Clustering: Applies clustering logic to classify each bar into:
Cluster 2 – Strong Bullish: Z-Score and CVD both strong
Cluster 1 – Divergence / Bull Trap: Z-Score high, but weak CVD
Cluster 0 – Neutral / Noise: No clear alignment
Anchored VWAP (NY Session Open): Confirms market structure and institutional trend bias from 9:30 AM ET forward.
🎯 Suggested Applications:
✅ 1. Trend Continuation Entries (Add-ons):
Look to add to positions when:
Cluster 2 signal occurs
Price is above the NY session VWAP
Price structure has broken out of prior day high/low or range
⚠️ 2. Divergence Detection (Fade Traps):
Cluster 1 signals a bearish divergence (e.g., high volume but weak CVD).
Especially useful when price is failing to stay above VWAP.
Useful for early exits or reversal setups.
📊 3. Volume Profile Confirmation:
Combine with fixed or session-based volume profile tools.
Use Z-Score clusters to confirm volume spikes into low-volume nodes (LVNs) or during imbalance transitions.
📍 4. VWAP Structure Confirmation:
Anchored VWAP acts as a dynamic reference point.
Helps confirm acceptance vs. rejection zones at key institutional levels.
📈 Visuals & Alerts:
Color-coded volume bars show intensity of Z-Score & CVD confluence
CVD Line plots real-time delta bias with green/red coloring
Cluster-based shape markers highlight key bars for actionable signals
Optional: Add alerts for Cluster 2 above VWAP or Cluster 1 below VWAP
⚙️ Customization Options:
Adjustable Z-Score length
Custom anchor timeframe for CVD (e.g., 1D or sessions)
Adjustable max lookback depth
Toggle VWAP inclusion
Extendable to include additional filters: RSI, structure break alerts, etc.
🔧 Ideal Use Cases:
NY session intraday traders (ES, NQ, CL, 6E, FX pairs)
Breakout traders wanting order flow confirmation
Mean reversion traders spotting fake moves
Volume-based scalpers looking for edge on short-term order imbalance
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.