OPEN-SOURCE SCRIPT
Structural Layer 2: Execution State Engine

The Structural Layer 2: Execution State Engine is a first-principles market classifier that strips away lagging indicators to analyze the raw relationship between price velocity and volume.
Built from scratch using rolling mathematical Z-scores, this indicator measures real-time market effort versus result. It compares current price spread (velocity) and external exchange volume against their structural baselines, grouping price action into four distinct "Execution States."
By categorizing every bar based on standard deviations from the mean, it visually highlights whether a move is backed by true conviction, being absorbed by larger players, or simply drifting on thin liquidity.
🚦 The 4 Execution States (Color Coded)
This indicator paints your chart’s bars to reveal the underlying market state (optimized for white backgrounds):
🔵 Blue (State A - Breakout Momentum): High Velocity + High Volume. True directional conviction. Price is covering significant distance backed by heavy participation.
🟠 Orange (State B - Institutional Absorption): Low Velocity + High Volume. High effort, low result. Heavy volume is entering the market, but the price isn't moving. This signals potential absorption, accumulation, or distribution by larger participants.
🟣 Purple (State D - Fragile Vacuum): High Velocity + Low Volume. Fast price movement on thin air. These are low-liquidity vacuum moves that are structurally fragile and often prone to mean reversion.
⚪ Light Gray (State C - No-Trade Drift): Low Velocity + Low Volume. The baseline noise. No significant volume and no significant price movement. Generally a chop or no-trade zone.
⚙️ Key Features
External Volume Routing: Fetch volume directly from major exchanges (default: Binance/Coinbase SOLUSD) to bypass localized data gaps and get a truer read on market participation.
Math from First Principles: Relies strictly on raw math (rolling means, variance, and Z-scores) instead of wrapped, smoothed TA functions that introduce lag.
Customizable Lookback: Adjust the structural lookback window (default: 48 hours) to tune the engine to your preferred timeframe and volatility baseline.
How to Use:
Use the bar colors to dictate your execution style. Ride momentum on Blue bars, look for reversals or traps on Orange bars, be cautious of fake-outs on Purple bars, and protect your capital from chop on Gray bars.
Built from scratch using rolling mathematical Z-scores, this indicator measures real-time market effort versus result. It compares current price spread (velocity) and external exchange volume against their structural baselines, grouping price action into four distinct "Execution States."
By categorizing every bar based on standard deviations from the mean, it visually highlights whether a move is backed by true conviction, being absorbed by larger players, or simply drifting on thin liquidity.
🚦 The 4 Execution States (Color Coded)
This indicator paints your chart’s bars to reveal the underlying market state (optimized for white backgrounds):
🔵 Blue (State A - Breakout Momentum): High Velocity + High Volume. True directional conviction. Price is covering significant distance backed by heavy participation.
🟠 Orange (State B - Institutional Absorption): Low Velocity + High Volume. High effort, low result. Heavy volume is entering the market, but the price isn't moving. This signals potential absorption, accumulation, or distribution by larger participants.
🟣 Purple (State D - Fragile Vacuum): High Velocity + Low Volume. Fast price movement on thin air. These are low-liquidity vacuum moves that are structurally fragile and often prone to mean reversion.
⚪ Light Gray (State C - No-Trade Drift): Low Velocity + Low Volume. The baseline noise. No significant volume and no significant price movement. Generally a chop or no-trade zone.
⚙️ Key Features
External Volume Routing: Fetch volume directly from major exchanges (default: Binance/Coinbase SOLUSD) to bypass localized data gaps and get a truer read on market participation.
Math from First Principles: Relies strictly on raw math (rolling means, variance, and Z-scores) instead of wrapped, smoothed TA functions that introduce lag.
Customizable Lookback: Adjust the structural lookback window (default: 48 hours) to tune the engine to your preferred timeframe and volatility baseline.
How to Use:
Use the bar colors to dictate your execution style. Ride momentum on Blue bars, look for reversals or traps on Orange bars, be cautious of fake-outs on Purple bars, and protect your capital from chop on Gray bars.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.