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 sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.