Market Regime Detector [forexobroker]

1 051
Market Regime Detector is an overlay indicator that automatically classifies current market conditions into one of three regimes — Trending, Ranging, or Volatile — and adapts its signal logic accordingly. In trending regimes, it generates signals based on EMA crossovers in the direction of the larger trend. In ranging regimes, it switches to Bollinger Band bounce signals with RSI confirmation. In volatile regimes, it suppresses signals entirely to protect traders from whipsaws.

The core problem this solves is strategy mismatch. Most indicators use a single logic for all conditions, generating trend-following signals in sideways markets (resulting in losses) or mean-reversion signals in strong trends (resulting in missed moves). By first identifying the regime and then applying the appropriate strategy, this indicator dramatically reduces false signals caused by using the wrong tool for the current environment.

This tool is designed for traders who want their analysis to automatically adapt to changing market conditions rather than manually switching between strategies.

🔶 CONCEPTS

Market regime theory recognizes that financial markets alternate between distinct behavioral states. In trending regimes, price moves directionally with momentum — trend-following strategies work well, and mean-reversion strategies fail. In ranging regimes, price oscillates between support and resistance — mean-reversion strategies work well, and trend-following signals produce whipsaws. In volatile regimes, price moves erratically with wide ranges and frequent reversals — most strategies struggle.

The detector uses three independent measurements to classify regimes: ADX (Average Directional Index) measures trend strength, Bollinger Band width percentile measures volatility expansion relative to history, and ATR percentile rank measures absolute volatility. By combining these metrics with specific thresholds, the indicator achieves reliable regime classification that updates in real time.

🔶 HOW IT WORKS

• ADX is calculated over a configurable period — values above the trend threshold (default 25) indicate trending conditions, values below the range threshold (default 20) indicate ranging conditions
• Bollinger Band width is ranked as a percentile over 100 bars, and ATR is similarly ranked — high ATR percentile (above 80) flags volatile conditions regardless of ADX
• The regime priority is Volatile > Trending > Ranging, ensuring that extreme volatility always takes precedence
• In trending regimes, buy signals fire on EMA 9 crossing above EMA 21 with price above EMA 50 and volume confirmation; sell signals use the inverse
• In ranging regimes, buy signals fire when price touches the lower Bollinger Band with RSI below the oversold level and volume confirmation; sell signals use the inverse conditions at the upper band
• In volatile regimes, no signals are generated — the dashboard shows "NO TRADE" to protect capital

🔶 HOW TO USE

1. Add the indicator to any chart — the regime classification appears immediately in the dashboard and as a background color (green for trending, blue for ranging, red for volatile)
2. Pay attention to regime change vertical lines — dashed lines with labels mark exactly where the market shifted from one regime to another
3. When a signal fires, the label shows whether it came from a trend strategy (EMA Cross) or range strategy (BB Bounce), so you understand the logic behind it
4. In volatile regimes, respect the "NO TRADE" indication — sitting out during extreme volatility is a valid and often profitable strategy in itself

🔶 FEATURES

• Non-repainting signals (uses barstate.isconfirmed)
• Works on all timeframes and instruments
• 9 alert conditions with webhook JSON support (including individual regime change alerts)
• Professional dashboard display with ADX, BB Width, and ATR rank readings
• Regime change vertical lines for clear visual transition markers
• Dual strategy engine that automatically selects the appropriate signal logic

🔶 SETTINGS GUIDE

• ADX Length — Period for ADX calculation (default: 14)
• ADX Trend Threshold — ADX above this classifies as trending (default: 25)
• ADX Range Threshold — ADX below this classifies as ranging (default: 20)
• Bollinger Length / Multiplier — Parameters for BB width and bounce signals (default: 20 / 2.0)
• ATR Length — Period for ATR volatility measurement (default: 14)
• ATR Volatility Percentile — ATR rank above this classifies as volatile (default: 80)
• EMA Fast / Slow — EMA periods for trending signal crossovers (default: 9 / 21)
• RSI Length — RSI period for ranging signal confirmation (default: 14)
• RSI Overbought / Oversold — RSI levels for ranging signal triggers (default: 65 / 35)
• Signal Cooldown — Minimum bars between consecutive signals (default: 15)
• Volume Multiplier — Volume must exceed SMA by this factor (default: 1.0)
• Show Regime Background / Change Lines / Dashboard — Visual toggles

🔶 ALERTS

• MRD Buy Signal — Fires on any confirmed buy signal (trend or range strategy)
• MRD Sell Signal — Fires on any confirmed sell signal
• MRD Any Signal — Fires on any confirmed signal
• Regime Change: Trending — Fires when market shifts to trending regime
• Regime Change: Ranging — Fires when market shifts to ranging regime
• Regime Change: Volatile — Fires when market shifts to volatile regime
• Strong Trend ADX>35 — Fires when ADX exceeds 35, indicating a powerful trend
• Extreme Volatility — Fires when ATR rank exceeds the 90th percentile
• Low Volatility Squeeze — Fires when BB width rank is below 10% and ADX below 15, signaling a potential breakout setup
• Webhook JSON — JSON-formatted alert for automated bot trading

🔶 LIMITATIONS & DISCLAIMER

• This is a technical analysis tool, not financial advice
• Past patterns do not guarantee future results
• Best used alongside price action context and proper risk management
• Regime transitions can be noisy near threshold boundaries, causing brief flickers between states
• The ranging strategy performs best in clearly defined ranges — during slow, drifting markets that are technically "ranging" by ADX but lack clear boundaries, BB bounce signals may be less reliable

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.