OPEN-SOURCE SCRIPT
Decoded Volatility Expansion [Ahtisham]

The Decoded Volatility Expansion engine is built on the principle of Market Compression vs. Expansion. Markets spend the majority of their time in a state of "Consolidation Noise." This strategy is designed to ignore that noise and only commit capital when volatility breaks a specific mathematical threshold—effectively "decoding" the moment a range expansion begin
CORE MECHANICS
The system utilizes a dynamic "Consolidation Box" to map institutional equilibrium before placing strategic stop-entry orders:
Volatility Decoding (ATR-Outlier): Unlike standard breakout bots, this engine uses an ATR-based multiplier to identify "Outlier Volatility." It sets entry triggers beyond the normal noise floor.
Equilibrium Mid-Line: The strategy identifies the zoneMid (Point of Control) of the recent consolidation. This acts as our "Gravity Point" for stop-loss placement, ensuring we exit if the breakout fails to sustain momentum.
Expansion Triggers: The system places passive Stop Orders (Aqua for Long, Orange for Short). These are only filled if the market demonstrates an aggressive expansion state.
Asymmetric Risk Management: Uses a customizable Reward-to-Risk (RR) ratio (Default 2.0) to ensure that winning expansions significantly outweigh "Fakeout" losses.
🎨 VISUAL INTELLIGENCE
The script features a high-fidelity "Hybrid Visual" interface:
The Gray Consolidation Box: A real-time visual representation of the current "Lookback" range being analyzed.
Expansion Labels: Clean, bold labels ("EXPANSION BUY/SELL") trigger at the exact moment of the volatility breakout.
Static Midline: A bold white axis representing the market's fair-value equilibrium during the consolidation phase.
Aqua/Orange Axis: Real-time tracking of the volatility-adjusted trigger levels.
📊 TECHNICAL SPECIFICATIONS
Strategy Type: Volatility Breakout / Momentum Expansion.
Instruments: Highly optimized for XAU/USD (Gold), BTC/USD, and high-beta Equities.
Timeframe: 15m (Scalp/Intraday) or 1H (Swing).
Execution: Orders utilize process_orders_on_close=true for realistic backtesting and to eliminate "repainting" illusions.
🛠️ HOW TO USE
Identify the Box: Observe the gray consolidation zone. This is where the engine is "Decoding" the current volatility.
Monitor the Triggers: Watch the Aqua (Upper) and Orange (Lower) lines. The closer price gets to these lines, the closer the system is to an "Armed" expansion state.
Risk Calibration: Adjust the Outlier Multiplier (default 1.5). Increase it for highly volatile news events to avoid "whipsaws," or decrease it for tighter, low-volatility sessions.
Target Setting: Set your Target Profit based on your specific asset's average daily range (ADR).
📜 VERSION HISTORY
V1.0 (Current): Initial release of the Decoded Expansion Engine with V6 syntax and hybrid visual labels.
⚖️ DISCLAIMER
This is a quantitative strategy for educational and research purposes. Trading high-volatility assets like Gold or Crypto involves significant risk. Always utilize proper position sizing and risk management.
Author: AHTISHAM_EE
Version: PineScript v6
CORE MECHANICS
The system utilizes a dynamic "Consolidation Box" to map institutional equilibrium before placing strategic stop-entry orders:
Volatility Decoding (ATR-Outlier): Unlike standard breakout bots, this engine uses an ATR-based multiplier to identify "Outlier Volatility." It sets entry triggers beyond the normal noise floor.
Equilibrium Mid-Line: The strategy identifies the zoneMid (Point of Control) of the recent consolidation. This acts as our "Gravity Point" for stop-loss placement, ensuring we exit if the breakout fails to sustain momentum.
Expansion Triggers: The system places passive Stop Orders (Aqua for Long, Orange for Short). These are only filled if the market demonstrates an aggressive expansion state.
Asymmetric Risk Management: Uses a customizable Reward-to-Risk (RR) ratio (Default 2.0) to ensure that winning expansions significantly outweigh "Fakeout" losses.
🎨 VISUAL INTELLIGENCE
The script features a high-fidelity "Hybrid Visual" interface:
The Gray Consolidation Box: A real-time visual representation of the current "Lookback" range being analyzed.
Expansion Labels: Clean, bold labels ("EXPANSION BUY/SELL") trigger at the exact moment of the volatility breakout.
Static Midline: A bold white axis representing the market's fair-value equilibrium during the consolidation phase.
Aqua/Orange Axis: Real-time tracking of the volatility-adjusted trigger levels.
📊 TECHNICAL SPECIFICATIONS
Strategy Type: Volatility Breakout / Momentum Expansion.
Instruments: Highly optimized for XAU/USD (Gold), BTC/USD, and high-beta Equities.
Timeframe: 15m (Scalp/Intraday) or 1H (Swing).
Execution: Orders utilize process_orders_on_close=true for realistic backtesting and to eliminate "repainting" illusions.
🛠️ HOW TO USE
Identify the Box: Observe the gray consolidation zone. This is where the engine is "Decoding" the current volatility.
Monitor the Triggers: Watch the Aqua (Upper) and Orange (Lower) lines. The closer price gets to these lines, the closer the system is to an "Armed" expansion state.
Risk Calibration: Adjust the Outlier Multiplier (default 1.5). Increase it for highly volatile news events to avoid "whipsaws," or decrease it for tighter, low-volatility sessions.
Target Setting: Set your Target Profit based on your specific asset's average daily range (ADR).
📜 VERSION HISTORY
V1.0 (Current): Initial release of the Decoded Expansion Engine with V6 syntax and hybrid visual labels.
⚖️ DISCLAIMER
This is a quantitative strategy for educational and research purposes. Trading high-volatility assets like Gold or Crypto involves significant risk. Always utilize proper position sizing and risk management.
Author: AHTISHAM_EE
Version: PineScript v6
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.