OPEN-SOURCE SCRIPT
cd_VW_Cx IMPROVED - Quant VWAP System: Regime, Magnets & Z-Sco

Quant VWAP System: Regime, Magnets & Z-Score Matrix
This indicator is a comprehensive Quantitative Trading System designed to move beyond simple support and resistance. Instead of static lines, it uses Statistical Probability (Z-Score) and Standard Deviation to define the current market regime, identify institutional value zones, and project high-probability liquidity targets.
It is engineered for Day Traders and Scalpers (Crypto & Futures) who need to know if the market is Trending, Ranging, or preparing for a Breakout.
1. The "Regime" System (Standard Deviation Bands)
The core engine anchors a VWAP (Volume Weighted Average Price) to your chosen timeframe (Daily, Weekly, or Monthly) and projects volatility bands based on market variance.
The Trend Zone (Inner Band / 1.0 SD): This is the "Fair Value" zone. In a healthy trend, price will pull back into this zone and hold. A hold here signals a high-probability continuation (Trend Following).
The Reversion Zone (Outer Band / 2.0 SD): This represents a statistical extreme. Price rarely sustains movement beyond 2 Standard Deviations without a reversion. A touch of this band signals "Overbought" or "Oversold" conditions.
2. Liquidity Magnets (Virgin VWAPs)
The script automatically tracks "Unvisited VWAPs" from previous sessions. These are price levels where significant volume occurred but have not yet been re-tested.
The Logic: Algorithms often target these "open loops." The script visualizes them as Blue Dashed Lines with price tags.
Smart Scaling (Anti-Scrunch): Includes a custom "Ghost Engine" that automatically hides or "ghosts" magnets that are too far away. This prevents your chart from being squashed (scrunched) on lower timeframes, keeping your candles perfectly readable while still tracking targets in the background.
3. The Quant Matrix (Dashboard)
A real-time Heads-Up Display (HUD) that interprets the data for you:
Regime: Detects Volatility Squeezes. If the bands compress, it signals "⚠ SQUEEZE", warning you to stop mean-reversion trading and prepare for an explosive breakout.
Bias: Color-coded Trend Direction (Bullish/Bearish) based on VWAP slope.
Signal: actionable text prompts such as "BUY DIP" (Trend Following), "FADE EXT" (Mean Reversion), or "PREP BREAK" (Squeeze).
4. Visual Intelligence
Bold Day Separators: Clear, vertical dotted dividers with Date Stamps to instantly separate trading sessions.
Dynamic Labels: Floating labels on the right axis identify exactly which deviation level is which, preventing chart confusion.
How to Use
Strategy A: The Trend Pullback (continuation)
Check Matrix: Ensure Bias is BULLISH (Green).
Wait: Allow price to pull back into the Inner Band (Dark Green Zone).
Trigger: If price holds the Center VWAP or the -1.0 SD line, enter Long.
Target: The next Liquidity Magnet above or the +2.0 SD band.
Strategy B: The Reversion Fade (Counter-Trend)
Check Matrix: Ensure price is labeled "EXTREME" or Signal says "FADE EXT".
Trigger: Price touches or pierces the Outer Band (2.0 SD).
Action: Enter counter-trend (Short) with a target back to the Center VWAP (Mean Reversion).
Strategy C: The Magnet Target
Identify a "MAGNET" line (Blue Dashed) near current price.
These act as high-probability Take Profit levels. Price will often rush to these levels to "close the loop" before reversing.
Settings
Anchor: Daily (default), Weekly, or Monthly.
Magnet Focus Range: Adjusts how aggressively the script hides distant magnets to fix chart scaling (Default: 2%).
Visuals: Fully customizable colors, label sizes, and dashboard position.
This indicator is a comprehensive Quantitative Trading System designed to move beyond simple support and resistance. Instead of static lines, it uses Statistical Probability (Z-Score) and Standard Deviation to define the current market regime, identify institutional value zones, and project high-probability liquidity targets.
It is engineered for Day Traders and Scalpers (Crypto & Futures) who need to know if the market is Trending, Ranging, or preparing for a Breakout.
1. The "Regime" System (Standard Deviation Bands)
The core engine anchors a VWAP (Volume Weighted Average Price) to your chosen timeframe (Daily, Weekly, or Monthly) and projects volatility bands based on market variance.
The Trend Zone (Inner Band / 1.0 SD): This is the "Fair Value" zone. In a healthy trend, price will pull back into this zone and hold. A hold here signals a high-probability continuation (Trend Following).
The Reversion Zone (Outer Band / 2.0 SD): This represents a statistical extreme. Price rarely sustains movement beyond 2 Standard Deviations without a reversion. A touch of this band signals "Overbought" or "Oversold" conditions.
2. Liquidity Magnets (Virgin VWAPs)
The script automatically tracks "Unvisited VWAPs" from previous sessions. These are price levels where significant volume occurred but have not yet been re-tested.
The Logic: Algorithms often target these "open loops." The script visualizes them as Blue Dashed Lines with price tags.
Smart Scaling (Anti-Scrunch): Includes a custom "Ghost Engine" that automatically hides or "ghosts" magnets that are too far away. This prevents your chart from being squashed (scrunched) on lower timeframes, keeping your candles perfectly readable while still tracking targets in the background.
3. The Quant Matrix (Dashboard)
A real-time Heads-Up Display (HUD) that interprets the data for you:
Regime: Detects Volatility Squeezes. If the bands compress, it signals "⚠ SQUEEZE", warning you to stop mean-reversion trading and prepare for an explosive breakout.
Bias: Color-coded Trend Direction (Bullish/Bearish) based on VWAP slope.
Signal: actionable text prompts such as "BUY DIP" (Trend Following), "FADE EXT" (Mean Reversion), or "PREP BREAK" (Squeeze).
4. Visual Intelligence
Bold Day Separators: Clear, vertical dotted dividers with Date Stamps to instantly separate trading sessions.
Dynamic Labels: Floating labels on the right axis identify exactly which deviation level is which, preventing chart confusion.
How to Use
Strategy A: The Trend Pullback (continuation)
Check Matrix: Ensure Bias is BULLISH (Green).
Wait: Allow price to pull back into the Inner Band (Dark Green Zone).
Trigger: If price holds the Center VWAP or the -1.0 SD line, enter Long.
Target: The next Liquidity Magnet above or the +2.0 SD band.
Strategy B: The Reversion Fade (Counter-Trend)
Check Matrix: Ensure price is labeled "EXTREME" or Signal says "FADE EXT".
Trigger: Price touches or pierces the Outer Band (2.0 SD).
Action: Enter counter-trend (Short) with a target back to the Center VWAP (Mean Reversion).
Strategy C: The Magnet Target
Identify a "MAGNET" line (Blue Dashed) near current price.
These act as high-probability Take Profit levels. Price will often rush to these levels to "close the loop" before reversing.
Settings
Anchor: Daily (default), Weekly, or Monthly.
Magnet Focus Range: Adjusts how aggressively the script hides distant magnets to fix chart scaling (Default: 2%).
Visuals: Fully customizable colors, label sizes, and dashboard position.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน