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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.