OPEN-SOURCE SCRIPT
AOC Market Regime Classifier

How it works
The indicator combines three core components:
EMA Structure (21 / 55) → measures directional bias
ATR (volatility normalization) → evaluates movement relative to market activity
Range Analysis (highest/lowest window) → detects compression and breakout conditions
Using these inputs, the script calculates:
Trend strength → distance between EMAs normalized by ATR
Range tightness → price compression relative to volatility
Breakout conditions → price escaping recent highs/lows
Regime Classification
The market is dynamically classified into four states:
TREND → Strong directional movement with sustained structure
RANGE → Low volatility, compressed price action
BREAKOUT → Price expansion beyond recent range
TRANSITION → Mixed or unclear conditions between regimes
Each regime is color-coded directly on the chart for quick visual interpretation.
What makes it useful
Helps filter trades based on market context
Prevents using the wrong strategy in the wrong environment
Highlights compression → expansion cycles
Keeps analysis simple and adaptive
How to use
Focus on trend-following strategies during TREND phases
Use mean-reversion approaches in RANGE conditions
Watch BREAKOUT for potential expansion opportunities
Be cautious during TRANSITION phases (lower conviction environment)
Key idea
Markets change behavior your strategy should too.
This tool helps you stay aligned with current conditions instead of applying a one-size-fits-all approach.
The indicator combines three core components:
EMA Structure (21 / 55) → measures directional bias
ATR (volatility normalization) → evaluates movement relative to market activity
Range Analysis (highest/lowest window) → detects compression and breakout conditions
Using these inputs, the script calculates:
Trend strength → distance between EMAs normalized by ATR
Range tightness → price compression relative to volatility
Breakout conditions → price escaping recent highs/lows
Regime Classification
The market is dynamically classified into four states:
TREND → Strong directional movement with sustained structure
RANGE → Low volatility, compressed price action
BREAKOUT → Price expansion beyond recent range
TRANSITION → Mixed or unclear conditions between regimes
Each regime is color-coded directly on the chart for quick visual interpretation.
What makes it useful
Helps filter trades based on market context
Prevents using the wrong strategy in the wrong environment
Highlights compression → expansion cycles
Keeps analysis simple and adaptive
How to use
Focus on trend-following strategies during TREND phases
Use mean-reversion approaches in RANGE conditions
Watch BREAKOUT for potential expansion opportunities
Be cautious during TRANSITION phases (lower conviction environment)
Key idea
Markets change behavior your strategy should too.
This tool helps you stay aligned with current conditions instead of applying a one-size-fits-all approach.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.