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.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.