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.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.