Why strategies fail in the wrong regime
A trend-following strategy runs a moving-average crossover or similar signal and stays long when price is above the average, short when below. In a trending market, this works well: momentum carries the trade, and the system rides directional moves for multiples of the initial risk.
In a ranging market — where price oscillates between support and resistance without sustained direction — the same system gets chopped apart. It buys at resistance, gets stopped out when price reverses. It shorts at support, gets stopped out when price bounces. Every signal is a whipsaw. The edge is not just reduced; it is inverted. The system systematically loses.
The inverse applies to mean-reversion strategies. A system that buys strength reversals works in range-bound conditions and destroys capital in a sustained trend.
This is not a backtest artifact or a parameter problem. It is a fundamental property of market microstructure: different environments favor different strategy types. A strategy cannot have positive expectancy across all regimes unless it adapts to them.
Regime filtering is the practice of detecting the current market environment and activating or deactivating strategies based on whether conditions match their edge.
The three core regimes
Markets do not exist in perfectly discrete states, but three broad categories capture most of the variation:
Trending (momentum) regime
Price moves directionally with above-average autocorrelation. Each period's return is positively correlated with the next. Breakouts follow through. Moving average crossovers, momentum factors, and trend-following systems perform well. Mean-reversion is expensive.
Ranging (mean-reverting) regime
Price oscillates within a range. Each period's return is negatively correlated with the next — strength fades, weakness recovers. RSI-based strategies, Bollinger Band mean-reversion, and statistical arbitrage perform well. Trend-following accumulates whipsaws and fees.
High-volatility / crisis regime
Rapid, large moves without clear direction. Correlation structures break down. Strategies with tight stops get stopped out repeatedly even if directionally correct. Liquidity contracts. Most systematic strategies perform poorly; cash or deep OTM options outperform. The primary goal is capital preservation.
Method 1 — ADX (Average Directional Index)
ADX measures the strength of a trend without regard to direction. It does not tell you whether price is going up or down; it tells you whether it is going somewhere at all. The calculation is based on the True Range and directional movement components.
ADX thresholds (Wilder's original guidelines)
ADX < 20: Weak or absent trend → ranging regime → favor mean-reversion
ADX 20–25: Developing trend → transitional
ADX > 25: Trend is present → trending regime → favor momentum
ADX > 40: Strong trend → watch for exhaustion
Standard period: 14 bars. Works on any timeframe. Laggy by design — reacts to regime, does not predict it.
ADX is the most widely used regime indicator because it is simple, interpretable, and available on every platform. Its limitations: it lags trend starts significantly, it can give false trending readings during volatile range-bound periods, and the standard 14-period setting may not be appropriate for all assets or timeframes.
Test your ADX threshold on your specific asset and timeframe. The 25 threshold that Wilder specified for TradFi daily bars is not necessarily optimal for 1-hour crypto bars.
Method 2 — Hurst Exponent
The Hurst exponent (H) is a more sophisticated measure of whether a series is trending, random, or mean-reverting. It quantifies the autocorrelation structure of returns.
Hurst exponent interpretation
H > 0.5: Persistent (trending) — past direction likely continues
H = 0.5: Pure random walk — no serial correlation
H < 0.5: Anti-persistent (mean-reverting) — past direction likely reverses
Calculated via rescaled range analysis (R/S) or detrended fluctuation analysis (DFA) on a rolling window of returns
Practical use: compute H on a rolling 100–200 bar window. When H is sustainably above 0.55, conditions favor trend-following. When below 0.45, conditions favor mean-reversion. When near 0.5, the environment is ambiguous.
Caveats: the Hurst exponent is notoriously noisy on short windows and sensitive to the calculation method. DFA tends to be more reliable than R/S for financial time series. A single H value means little; you need to watch the rolling trend over many bars.
The Hurst exponent is most useful as a secondary confirmation tool, not a primary decision variable. Use it alongside ADX or volatility measures rather than in isolation.
Method 3 — Volatility regime
Volatility is its own regime signal. Periods of realized volatility well above historical norms correspond to crisis or high-uncertainty regimes where most systematic strategies suffer. Periods of below-average volatility often correspond to trend or range environments where strategies operate more normally.
Volatility-based regime classification — daily returns
Calculate: 20-day realized volatility (annualized) = std(daily_returns) × √252
Regime thresholds (calibrate to asset history):
RealVol < 15%: Low-vol regime → strategies perform best
RealVol 15–30%: Normal regime → standard risk sizing
RealVol 30–50%: Elevated regime → reduce position size by 30–50%
RealVol > 50%: Crisis regime → reduce to minimum or flat
Thresholds are asset-specific: BTC has a different historical vol baseline than ES futures
Volatility-based regime filters are particularly easy to implement and backtest cleanly. The approach is transparent, the signal is continuous (not a binary threshold), and position sizing in response to volatility is a standard risk management technique regardless of regime framing.
Method 4 — Hidden Markov Models
Hidden Markov Models (HMMs) treat market regimes as unobserved (hidden) states that generate observable returns. The model learns, from the return sequence, the most likely state at each point in time and the transition probabilities between states.
- →Inputs: Daily or hourly returns (sometimes with volatility features added)
- →Output: Probability of being in each state at each point in time
- →States: Typically 2–3 states (low-vol trending, high-vol crisis, ranging). The model learns the characteristics of each state from data, not from explicit thresholds.
- →Python implementation:
hmmlearnlibrary, Gaussian HMM with 2–3 states, fitted on training data, applied to test data in a walk-forward setup
HMMs are more sophisticated than ADX or Hurst, but they introduce more room for overfitting. A 2-state HMM fitted on 5 years of BTC returns identifies the states present in those 5 years, which may not generalize if a new type of regime emerges. The model output (regime probability) must be treated as soft signal, not ground truth.
HMM vs. other regime models →
Use our ML Model Comparison tool to benchmark HMM performance against simpler rule-based approaches on your specific asset and time horizon before committing to a more complex model.
Combining regime signals and acting on them
The practical implementation question is not which single regime indicator to use, but how to combine signals and what to do with the output.
Signal combination: A simple majority-vote approach works reasonably well. Assign a regime vote to each indicator (trending / ranging / high-vol), and take the consensus. If ADX says trending and Hurst says anti-persistent, the signals disagree — treat the environment as ambiguous rather than forcing a classification.
Acting on the regime: Two practical approaches:
Binary filter
The strategy only trades when the regime matches its design. A trend-following system goes flat when ADX drops below 20. Simple and transparent, but reduces trade frequency significantly and increases regime misclassification risk — you stop trading right as a new trend begins, which is the worst possible timing.
Continuous position sizing
Scale position size based on regime confidence, not a binary on/off. ADX 30 (strong trend) = full size. ADX 20 (borderline) = half size. ADX 15 (ranging) = quarter size or zero. This preserves edge in transitional environments and avoids the cliff-edge timing problem of binary filters.
Continuous sizing is generally preferable because it is more robust to imprecise regime classification. The binary filter is more common in practitioner implementations because it is easier to explain, audit, and backtest.
Backtesting a regime filter correctly
Adding a regime filter to a strategy is a parameter choice. It will improve in-sample performance almost by construction — you are removing losing trade clusters by definition when you filter out the regime that produces them. This is spurious in-sample improvement, not real edge.
Validate regime filters the same way you validate any strategy parameter:
- →Use the regime signal as a filter in a walk-forward test. The regime threshold is optimized on each IS window and applied frozen to the OOS window.
- →Measure the stitched OOS equity curve vs. the unfiltered base strategy on the same OOS windows. If the filter improves OOS results consistently across many windows, it is likely adding real value.
- →Watch for the filter to flip from "improves" to "hurts" across different OOS windows. If results are inconsistent across windows, the filter is regime-specific and will not generalize.
- →Account for the reduced trade count when comparing Sharpe ratios. A filter that removes 40% of trades and improves Sharpe from 0.8 to 1.2 may look impressive; check whether the improvement is statistically significant on the smaller sample.
Summary
- Strategies have edge only in specific regimes; regime filtering activates or deactivates strategies based on whether current conditions match their design
- The three core regimes are trending (momentum), ranging (mean-reverting), and high-volatility/crisis (capital preservation)
- ADX above 25 indicates a trending regime; below 20 indicates ranging. Hurst exponent above 0.5 indicates persistence; below 0.5 indicates mean-reversion. Realized volatility provides an independent dimension for risk regime
- HMMs are more sophisticated but introduce overfitting risk; validate on out-of-sample data before using
- Continuous position sizing scaled to regime confidence is generally more robust than binary on/off filters
- Never optimize a regime filter in-sample and call the improvement real. Walk-forward validate the filter against the unfiltered baseline on out-of-sample windows before trusting it
Frequently asked questions
What is a market regime in trading?
A market regime is a persistent statistical environment characterized by a particular behavior pattern: trending (directional momentum), ranging (mean-reverting, range-bound), or high-volatility/crisis (directionless, rapid reversals). Regimes are not perfectly discrete — they blend and transition — but identifying the dominant regime helps determine which strategy types are likely to have edge in the current environment.
How do you detect a market regime?
Common approaches include: the ADX indicator (above 25 suggests trending, below 20 suggests ranging); the Hurst exponent (above 0.5 suggests trending, below 0.5 suggests mean-reversion); volatility regime models (VIX or realized volatility thresholds); Hidden Markov Models (statistical models that infer latent regime states from returns); and rolling Sharpe comparison across trend-following and mean-reverting signals.
What is the Hurst exponent in trading?
The Hurst exponent (H) measures the long-term memory or autocorrelation of a time series. H > 0.5 indicates persistence (trends): past returns predict future returns in the same direction. H < 0.5 indicates anti-persistence (mean-reversion): past returns predict reversal. H = 0.5 is pure random walk. In practice, H fluctuates over rolling windows rather than being a fixed property, making it a useful but noisy regime indicator.
Can you automate regime detection?
Yes. Regime detection is automatable using rule-based filters (ADX threshold, volatility percentile) or probabilistic models (HMM, Gaussian mixture models). The challenge is that regime boundaries are not sharp in real data, and models trained on one regime history may not generalize to new regimes. Regime detection should be treated as a soft signal that modulates position size or strategy selection, not a binary on/off switch.
Does regime filtering always improve strategy performance?
Not always. Adding a regime filter that prevents trading in unfavorable regimes will reduce trade frequency. If the filter is miscalibrated, it may also filter out good trades more often than bad ones. Validate any regime filter on out-of-sample data with walk-forward analysis before deploying it. A filter that improves in-sample results dramatically should be viewed with suspicion — it may have been fit to the specific regimes present in your test data.
Compare regime detection models before committing
Different regime detection approaches perform differently across asset classes and time horizons. Use our free ML Model Comparison tool to benchmark common approaches on your data before wiring one into your strategy.