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
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.