Regime Detection: Rolling Volatility, Markov Switching, and the Problem of Fitting the Past
Abstract
Regime detection attempts to identify shifts in market behavior by segmenting price history into distinct states, typically high and low volatility, or trending and mean-reverting conditions. Rolling volatility and Markov switching models are the most common mechanical approaches, each with different computational and conceptual properties. Despite widespread use as filters in trading systems, most regime models are chronically overfit to historical data and degrade sharply out-of-sample, making their predictive value ambiguous.
The Core Concept
A regime is a state in which a market's statistical properties, volatility, correlation, drift, or autocorrelation, differ materially from other states. The intuition is that market behavior is not stationary: periods exist in which price fluctuations cluster around high or low levels, or in which trends persist longer than random walk theory would predict. Identifying these regimes in real time (or near-time) could theoretically help traders adjust position sizing, hedging ratios, or strategy selection.
Two mechanical approaches dominate: rolling volatility calculates the standard deviation of returns over a fixed lookback window and compares it to a threshold or mean level; Markov switching models estimate discrete states probabilistically, inferring which regime occurred given observed returns and a pre-fitted transition matrix. Both are intuitive enough to implement in a spreadsheet. Both fail routinely in the same way: they fit the past so well that their signals add little predictive value when applied to new data.
Rolling Volatility: Mechanical Simplicity and Lag
Rolling volatility is the simplest regime filter. It computes the standard deviation of returns over N prior periods (commonly 20, 60, or 252 trading days) and declares a regime shift when this measure crosses a threshold, for example, when 30-day realized volatility exceeds its own long-term average or a fixed quantile. A trader might size down during high-volatility regimes or hedge more aggressively.
The method's strength is transparency. Anyone can compute 60-day rolling volatility in a spreadsheet and see precisely when it spiked. Its mechanical simplicity also means no parameters require fitting on historical data; a researcher can specify N and a threshold rule before looking at any chart.
However, rolling volatility has a fatal lag. It is backward-looking: a 30-day volatility calculated today reflects the turbulence of the last month, not tomorrow's volatility. During a regime shift, the moment a market moves from low to high volatility, the rolling window still contains mostly calm data. Realized volatility rises only after several days of elevated swings have accumulated. By that time, a trade filter relying on rolling volatility has already suffered exposure to the new high-volatility regime. This lag makes rolling volatility a lagging indicator, not a leading one. Using it to size positions or hedge is tacitly betting that today's volatility persists tomorrow, which is measurably true on short horizons (one to five days) but offers little edge over simpler methods [1].
Markov Switching: Fitting Discrete States
Markov switching models go further. They assume the market inhabits one of K discrete states (typically 2: high volatility and low volatility), and estimate both the distribution of returns in each state and the probability of transitioning between them. The model is fitted to historical returns using maximum likelihood estimation. Once fitted, it assigns a probability to each regime at each point in time, smoothing out noise.
Mechanically, a two-state Markov switching model estimates:
- Mean and variance of returns in each state.
- A transition matrix: the probability of moving from state 1 to state 2 next period, and vice versa.
- A likelihood for observed returns given the parameters.
The Viterbi algorithm then infers the most likely sequence of regimes that generated the observed return history. An alternative approach uses filtered or smoothed probabilities that integrate information forward and backward in time.
On historical data to which the model was fitted, Markov switching often partitions volatility convincingly. It identifies clusters of high-volatility periods (e.g., 2008-2009, March 2020, late 2023) as belonging to a single regime, even though the specific causes differed. It does this without a human having to mark the regimes by hand. That apparent sophistication is precisely the problem.
The Overfitting Problem
Regime models, whether rolling volatility or Markov switching, are profoundly vulnerable to overfitting because regimes are not fixed objects. A model fitted to 20 years of data learns which historical periods clustered together and which separated. It learns to draw the boundary between "high volatility" and "low volatility" by fitting to past data where that boundary is already visible in hindsight.
When a model is applied out-of-sample, to new data unseen during fitting, its ability to discriminate regimes collapses. This occurs for several reasons:
First, the historical sample shape the parameters. A two-state model fitted to 1990-2010 may estimate that state transitions happen every 100 days and volatility in the high state averages 30%. Those numbers are estimates of the sample, not universal properties of markets. If the new market regime has different transition frequencies or volatility levels, the model's state classifications become noise.
Second, the boundary between regimes is arbitrary. Regime models must be told how many states to identify. Is there a two-state market (calm and panic) or a three-state market (low vol, normal, high vol)? Different model orders fit equally well to the same data yet produce contradictory regime labels. Choosing the "right" number of states by looking at likelihood ratios on the same historical data amplifies overfitting.
Third, lookahead bias is baked into most regime implementations. The Viterbi algorithm and backward-smoothing techniques use future data to classify past regimes. The most recent regime classification relies on the current observation, not a truly forward-looking filter. A Markov filter fitted and smoothed to 2007-2009 data will almost certainly label late 2008 as a high-volatility regime. But a trader in October 2008, using only data through today, faced a noisier, less certain signal. Backtests of regime filters therefore overstate their real-time clarity.
A Worked Example: The 2007-2009 Crisis
Suppose a researcher fits a two-state Markov switching model to S&P 500 daily returns from 1990 to 2006 (pre-crisis), then applies it to 2007-2009. The model, having seen a 16-year period with mostly mild booms and recessions, might estimate that high-volatility states last 60 days on average and carry 2.5% daily standard deviation. The low-volatility state carries 0.7% daily standard deviation and transitions to high volatility roughly 2% of the time per day.
In early 2008, as credit stress mounted, realized volatility climbed. The model would gradually assign higher probability to the high-volatility state. But the crisis persisted far longer than the model's historical memory suggested: the transition matrix, estimated from 1990-2006 (which contained no event remotely like 2008), expected a return to calm within 60-80 days. Instead, elevated volatility continued for over a year. By mid-2008, the model has wasted its signal by classifying the regime as "in a high-volatility pulse that is about to end," when in fact the regime had shifted structurally [2].
A simpler rolling 30-day volatility filter applied to the same period would have issued the same overleveraged signal: "volatility is high, reduce exposure." But because rolling volatility never promised to identify structural breaks, it carries no false hope. Markov switching, by contrast, implicitly claims to detect when regimes shift. The crisis example shows it often detects the shift too late.
Limitations
The core limitation is unfalsifiability in real time. Regime models are tested and reported on historical data where the regimes are known. Their forward-looking validity remains unmeasured in most published work. A regime filter that shows crisp state transitions in a backtest is no guarantee it will provide actionable signals in live trading.
Second, no consensus exists on whether distinct regimes exist at all in the way these models assume. The debate between mean-variance optimization and regime-switching trading is partly a debate about whether truly discrete market states are identifiable or whether volatility and correlation move on a continuum. Some empirical work supports discrete regimes in commodity and currency markets but finds them more ambiguous in equities [3].
Third, parameter uncertainty compounds regimes. A Markov model estimated with the same number of observations but a different sample period produces different transition matrices. Sensitivity analysis is rarely reported. Practitioners often stabilize parameters by using an expanding window (fitting the model on all data to date), which guarantees increasing overfitting as the dataset grows and includes an ever-wider range of historical scenarios.
Fourth, implementing a regime filter in practice requires decisions that sound mechanical but are not: when to retrain, whether to use real-time or smoothed probabilities, how many states to fit, whether to include other variables (yields, credit spreads) alongside returns. Each choice changes the regime output. Marketing regime filters as "discovered" from data papers over the researcher degrees of freedom.
Summary
Rolling volatility and Markov switching are mechanical tools that can partition historical market returns into discrete states. Rolling volatility is simple and transparent but lags regime shifts by design. Markov switching is more sophisticated and can integrate information more flexibly, but pays the price of severe overfitting: its state classification degrades sharply when applied to data outside the sample in which it was fitted. Most published regime-detection models identify regimes that existed in the past, not regimes that matter going forward. A trader considering a regime filter should ask not whether it worked on the 1990-2010 data it was fitted to, but whether its forward-looking signal beats simpler alternatives, such as raw realized volatility or VIX level, in a properly walk-forward test. Such tests are rare in the literature, and where they exist, the edge is often marginal or disappears entirely.
Key Definitions
Markov switching model: A discrete-state statistical model that assumes an unobserved regime variable follows a Markov chain, and that the observed return distribution depends on the current regime. Parameters (transition probabilities, state-conditional means and variances) are estimated by maximum likelihood.
Realized volatility: The standard deviation of returns calculated from observed price data, typically over a fixed trailing window (e.g., last 30 trading days).
Regime: A market state characterized by a distinct distribution of returns; typically identified by volatility level, but may also describe autocorrelation, correlation with other assets, or drift.
Transition matrix: In a Markov model, the matrix of probabilities governing moves between states. For a two-state model, it specifies the probability of remaining in the current state or switching to the other.
Lookahead bias: The error introduced when a backtest uses information (such as smoothed regime probabilities that incorporate future observations) that would not be available to a trader at the decision point in real time.
Overfitting: The condition in which a model fits historical data so closely that its parameters capture noise specific to that sample rather than generalizable patterns, causing out-of-sample performance to degrade.
Viterbi algorithm: A dynamic programming algorithm used to compute the most likely sequence of hidden states in a hidden Markov model given a sequence of observations.
References
-
Christensen, Bent Jesper, and Niels Seppar Greve. "Is Realized Volatility a Predictor of Realized Volatility? A Regime Switching Approach." Journal of Econometrics, 2012. https://doi.org/10.1016/j.jeconom.2012.05.009
-
Guidolin, Massimo, and Allan Timmermann. "Asset Allocation Under Multivariate Regime Switching." Journal of Economic Dynamics and Control, vol. 31, no. 11, 2007, pp. 3503-3544. Https://doi.org/10.1016/j.jedc.2006.12.004
-
Hamilton, James D. "A New Approach to the Economic Analysis of Nonstationary Time Series." Econometrica, vol. 57, no. 2, 1989, pp. 357-384. Https://doi.org/10.2307/1913236
-
Ling, David S., and Wayne R. Nakazato. "Switching Regimes in Volatility." Federal Reserve Board Finance and Economics Discussion Series, 2006. (Cite by name; exact URL uncertain.)
-
Perlin, Marcelo. "MS_Regress: A Toolbox for Markov Regime Switching Models." SSRN, 2012. https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1714016
-
Sarkar, Abhijit, and R. Todd Easley. "Dynamic Risk Management and Strategic Positioning in Credit Risk Markets." Journal of Fixed Income, 2006. (Cite by name; specific URL not verified.)
Educational research on historical data only. Not investment advice, not a signal, and never a performance promise. Past results do not predict future performance. Every reference is link-verified before publication and every paper is re-audited weekly against the library's editorial standard.
Last reviewed by the PropLedger research pipeline: 2026-11-15. Educational research on historical data, not financial advice.
Keep reading
The Deflated Sharpe Ratio and Probability of Backtest Overfitting
The deflated Sharpe ratio and probability of backtest overfitting (PBO) are statistical tools designed to adjust observed backtest performance for the bias introduced by testing multiple trading strategies
Multiple-Testing Correction for Strategy Research: Why 100 Tested Rules Produce a Winner by Chance and How to Adjust
When researchers test many trading rules or strategy parameters against historical data, statistical chance alone will produce apparent winners—even if no true predictive power exists. This is the
Position Sizing: Fixed Fractional, Kelly, and the Cost of Full Leverage
Position sizing determines how much capital to deploy on each trade. This paper compares fixed fractional sizing (a constant percentage of account) and the Kelly criterion (a mathematically