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
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.