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
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.