Systematic Trading Field Guide
2.7 · Not fooling yourself

Regime dependence — when an edge lives entirely in 18 months

~13 min read
Mechanism

A thirty-year average return can be manufactured entirely by eighteen months of it — or destroyed by eighteen months the sample happens not to contain. Markets move between persistent regimes, so the effective sample size for "does this edge survive across environments?" is not the number of months you have but the number of regimes you've visited, which is almost always a single-digit number. Decompose every backtest by regime before believing its average; and treat any regime filter added after seeing the results as one more trial in the multiple-testing count.

The idea

Let me show you two backtests that are the same backtest.

The first: an FX carry strategy tested from 2010 to 2019. Sharpe 1.1, gentle drawdowns, beautiful. The second: the same rules tested from 2003 to 2012. Sharpe near zero, with a drawdown in 2008 that erases five years of gains in four months. Nothing about the strategy changed — only the window. The first sample happens to sit inside a decade of suppressed volatility, zero rates and steady risk appetite: one long environment friendly to carry. The second contains the environment that carry is, mechanically, short — the claim event of the insurance premium (lesson 5.4's subject).

The uncomfortable general fact is that this isn't a special property of carry. Financial markets spend years at a time in persistent states — tight-money versus easy-money, calm versus turbulent, trending versus chopping — and returns to most strategies differ across those states far more than they vary within them. Ang and Timmermann (Ang & Timmermann 2012) survey the regime-switching literature and the message for a practitioner is double-edged: regimes are statistically real (means, volatilities and correlations genuinely shift, abruptly, and the states persist), and they are identified confidently mostly in hindsight — the econometrics can tell you the world changed about six months after you needed to know.

Why does this matter so much for not fooling yourself? Because it quietly destroys the sample size you think you have. Lesson 2.6 taught you that ten years of monthly data is 120 observations with wide error bars. This lesson is worse: for the question "does the edge survive across environments?", those 120 months are not 120 draws. They are perhaps three or four draws — the number of distinct regimes the window visited. A backtest spanning 2012–2019 has visited approximately one regime. Its evidence about regime-robustness is a sample of one, whatever its t-statistic says.

The canonical worked demonstration in the literature is momentum. Averaged over a century, cross-sectional momentum is one of the strongest effects ever documented; but Daniel and Moskowitz (Daniel & Moskowitz 2016) show its losses concentrate almost entirely in one situation — sharp market rebounds following bear markets, 1932 and 2009 being the monsters — where the strategy's short leg (recent losers: beaten-down, high-beta, option-like stocks) explodes upward. The strategy is fine in three regimes and catastrophic in a fourth that arrives a few times per century. Average statistics blend the four into a smooth number that describes none of them.

There are two distinct sins here, and you must keep them separate because their remedies are opposite.

Sin one: not conditioning when you should. You run the backtest, see the average, and never ask which environments produced the P&L. You are then holding a hidden factor bet — short volatility, short funding stress, long duration — without knowing it, and you'll discover the exposure the way people discover load-bearing walls. The remedy is more analysis: decompose the P&L by regime, every time, as a standard report.

Sin two: conditioning because you peeked. You run the backtest, see it loses in high-volatility months, and add "only trade when VIX below its median". Sharpe improves; you feel scientific. What actually happened: you observed noise's location in-sample and cut around it, which is precisely the garden-of-forking-paths variant-mining of lesson 2.3 — Harvey, Liu and Zhu's trial count (Harvey, Liu & Zhu 2016) just went up by one (or by the number of filters you silently auditioned), and the improvement is mostly imaginary. The remedy is less freedom: regime cuts must be specified before you look, and must come from the mechanism, not from the equity curve.

The mechanism is the referee between the sins. For an insurance-type strategy, the mechanism predicts losses in the claim regime — a carry backtest that shows profits in 2008 has a bug (probably lookahead in the funding data), not an edge. For a constraint-flow strategy, the mechanism says returns should exist only when the constrained payer is active — reconstitution profits should sit in reconstitution windows, and finding them spread evenly through the year is evidence against the mechanism. Conditioning that tests a pre-stated mechanical prediction is science; conditioning that improves a disappointing average is mining. The two can produce identical code and identical charts, which is why lesson 1.10's pre-registration habit — write the predicted regime pattern down first — is the only reliable way to keep yourself honest.

The maths

One idea earns formality: the effective number of regime draws. Suppose returns come from a two-state world — call the states CC (calm) and SS (storm) — where the state each month follows a Markov chain: from calm, the world stays calm next month with probability pp; from storm it stays stormy with probability qq. Your strategy's monthly return has mean μC\mu_C in calm and μS\mu_S in storm.

The long-run fraction of time in calm is πC=1−q2−p−q\pi_C = \frac{1-q}{2-p-q}, and the unconditional mean every backtest reports is the blend

μˉ  =  πC μC+(1−πC) μS.\bar\mu \;=\; \pi_C\,\mu_C + (1-\pi_C)\,\mu_S .

Nothing exotic. The sting is in the persistence. With monthly persistence p=q=0.94p = q = 0.94 — regimes lasting about 1/(1−p)≈171/(1-p) \approx 17 months on average, entirely realistic for volatility and policy regimes — a ten-year window contains about 120/17≈7120/17 \approx 7 regime spells, split between the two states. Your estimate of μS\mu_S, the number that decides whether the strategy survives storms, rests on maybe three spells. And if the window happens to contain zero storm spells, the backtest estimates μˉ=μC\bar\mu = \mu_C with great confidence and total irrelevance: it has measured the premium and never once observed the claim. Symbols, once more: πC\pi_C is the long-run calm fraction, p,qp, q the state-persistence probabilities, and 1/(1−p)1/(1-p) the expected spell length that turns months of data into the far smaller count of independent environment-draws.

Worked example

Worked example — a strategy that is entirely a regime bet

Build the two-state world concretely. Calm months (85% of the time): strategy earns +1.5% with 2% volatility. Storm months (15%): it loses 8% on average with 6% volatility. The unconditional monthly mean:

μˉ=0.85×1.5%+0.15×(−8%)=1.275%−1.200%=0.075%\bar\mu = 0.85 \times 1.5\% + 0.15 \times (-8\%) = 1.275\% - 1.200\% = 0.075\%

About 0.9% a year — roughly nothing. The full-sample truth is that this strategy earns a fat premium and pays it all back in claims. Now watch what windows do:

Sample seenMonths of storm includedAnnualised returnVerdict you'd reach
Full history (long)~15%~0.9%Correct: no net edge
5 calm years0~19.6%"Exceptional strategy"
3 years incl. one 6-month storm~17%~ −1.6%"Broken, abandon"
The storm itself100%~ −63%"Catastrophe"

Every row is the same strategy. The five-calm-year row is the dangerous one: with 2% monthly vol and +1.5% mean, its measured Sharpe is around 2.6 — enormous, stable-looking, and (per lesson 2.6) even statistically convincing, because sampling error is small when you repeatedly draw from one state. The statistics are fine; the sample is unrepresentative. High t-statistics cannot save you from a window that never visited the state that kills you.

The standard report your framework should print for every backtest is a decomposition like:

def regime_report(returns, regimes):
    """returns: monthly series; regimes: pre-registered labels, e.g.
    vol tercile of the PRIOR month (no lookahead), rate era, recession flag."""
    out = returns.groupby(regimes).agg(['mean', 'std', 'count'])
    out['ann_sharpe'] = out['mean'] / out['std'] * 12**0.5
    out['pnl_share'] = returns.groupby(regimes).sum() / returns.sum()
    return out

Two implementation notes that keep it honest. The regime label for month tt must be computable at the end of month t−1t-1 — labelling months by their own realised volatility smuggles in lookahead (lesson 2.1's timestamp discipline). And pnl_share is the number to stare at: if one label owns 90% of total P&L with 20% of the months, you don't have a strategy plus a regime; you have a regime trade wearing a strategy's clothes — which is fine, if the mechanism says so and you sized for it.

How you'd use it

Pre-register three or four cuts, and always the same ones. Before any backtest: prior-month volatility terciles; a rates era split (pre/post the 2008 zero-rate boundary, pre/post the 2022 hiking cycle); recession months versus not; and for anything with an insurance shape, "claim windows" named in advance (2008Q3–2009Q1, March 2020, and this module will make you glad you included 1932 where data allows). Fixed cuts, applied uniformly, reported every time — so there is no garden of forking paths to wander.

Demand the mechanism predict the pattern, in writing, first. One sentence before looking: "this is a liquidity-provision premium, so it should lose in the vol-spike tercile and earn most in calm months." Then check. A match is real evidence — far better evidence than the headline Sharpe, because it was a falsifiable prediction. A mismatch is a red flag even when the average is good: profits arriving in the regime where the mechanism says you pay claims usually means a data bug or the wrong story.

Count storms, not months. Next to every backtest Sharpe, record: how many distinct high-stress episodes does this window contain, and what happened in each? "Sharpe 1.0 over 12 years, including 2008, 2020 and 2022, profitable claim-handling in two of three" is a statement of evidence. "Sharpe 1.4 over 2013–2019" is a statement about the weather.

Treat every filter as a purchase. If you do add a regime condition, log it in the trial register of lesson 1.10 and pay for it at the lesson-2.3 exchange rate. Then demand the filtered strategy re-justify itself on the pre-registered cuts — a filter fitted to one window has a convenient habit of failing the next storm from a slightly different direction.

What goes wrong

The edge that was one episode. Deep value in 2000–2002, short-anything in 2008, long-anything-crypto-adjacent in 2020–21: whole track records — published papers, too — reduce to one historical episode plus noise. The tell is the P&L-share line: one contiguous stretch owning nearly all of it. The honest conclusion isn't necessarily "worthless"; it's "this is a bet on that state recurring, with essentially one observation of the payoff," which changes sizing (module 4) and confidence entirely.

The unvisited state. The inverse and nastier case: the bad regime simply isn't in your data. Short-vol tested 2012–2017 contains zero volatility catastrophes; EUR-CHF carry before January 2015 contained zero peg breaks. No statistical procedure detects the absence — only the mechanism does ("this is insurance; where are the claims in my sample?"). When the sample holds no claims, the backtest is measuring premium income only, and sizing must come from the imagined claim (stress tests, lesson 9.5's logic), not from the observed history.

Regime variables that are the market in a hat. Conditioning on VIX levels, credit spreads or drawdown states often just re-derives "don't be short when things are bad" — timing the market with extra steps and less breadth. Check what the filter does to your average market exposure; if the "regime alpha" is mostly beta timing, module 4.8's scepticism about factor timing applies with full force.

Structural breaks masquerading as regimes. Some shifts don't revert: decimalisation, the ETF-isation of everything, the post-2010 speed race in microstructure (module 8 territory). A regime implies return; a break means the old data describes a market that no longer exists. If the edge lives entirely before a plausible break — a reconstitution effect before index providers changed their announcement practices, say — no amount of subsequent averaging brings that evidence back to life. Date the data's relevance, not just its extent.

Hindsight regimes. Finally, the subtle one: the regimes themselves are usually only identifiable after the fact (Ang & Timmermann 2012). A backtest that trades on regime labels fitted over the full sample — an HMM trained once on all thirty years, then "applied" historically — has lookahead in its conditioning variable, the 2.1 sin at one remove. Regime detection used in a strategy must be walk-forward like everything else; regime labels used to analyse a strategy should be simple, mechanical and computable in real time, or you are explaining one unknowable with another.

Further reading