Skip to main content
Back to Tutorial
StarterUSMean Reversion11 min readUpdated 2026-04-02

What is mean reversion, and when does it stop working?

The first statistical pattern every quant learns, and the one that gets most retail traders blown up. We cover the theory, the microstructure, and three live templates you can fork and stress-test.

Mean reversion is the observation that extreme price moves tend to partially reverse within a predictable horizon. It is the single most studied anomaly in quantitative finance, first formalised by DeBondt & Thaler in 1985 and documented in every major equity market since.

It is also the pattern most retail traders learn first and blow up on second. This article walks through why the signal works, where it reliably fails, and two live templates you can fork to see it in action on real market data.

The theoretical setup

The canonical construction is simple: compute the z-score of recent returns against a longer rolling window. When a stock drops sharply (z < -1.5), a long position tends to generate positive expected returns over the following 5 trading days. The mechanism is microstructural — overreaction to news, forced liquidations, and bid-ask bounce all push price temporarily away from "fair value".

Starter template — pure z-score reversion on S&P 500 with a breadth gate.
TemplateUSMean Reversion
Mean Reversion on S&P 500

Z-score reversion on 5-day returns with breadth gate

Sharpe
1.42
Return
+16.9%
Max DD
−9.8%
Forks
86

Why the breadth filter matters

Naive mean reversion fails exactly when it hurts most: during genuine downtrends. A stock that drops -2σ on Monday inside a -10% market week is not reverting — it is leading the selloff. The McClellan oscillator, computed from advancing vs. declining issues, separates the two regimes. When breadth is collapsing, you disable the strategy. When breadth is stable or improving, the z-score signal has its full edge.

The generalised lesson

Every statistical anomaly has a conditioning variable that separates its "on" regime from its "off" regime. Without that conditioning, you are just collecting the average of both states — which is often zero.

Intraday mean reversion: a different animal

Daily mean reversion is a factor. Intraday mean reversion is microstructure. When option market makers are net long gamma, their delta hedging mechanically dampens price moves — selling into rallies, buying into dips. This creates a systematic intraday reversion that has nothing to do with fundamentals.

Advanced template — fades intraday SPY moves when dealer gamma is positive.
TemplateUSMean Reversion
SPY GEX Fade

Fade intraday moves when dealer gamma is positive

Sharpe
1.94
Return
+28.3%
Max DD
−7.1%
Forks
148

When mean reversion stops working

There are three regimes where reversion strategies quietly die. First, when volatility clusters — once σ rises above its recent median, reversion becomes continuation. Second, when a single factor (usually macro) dominates all cross-section. Third, when dealer gamma flips sharply negative, intraday moves amplify rather than fade. Your strategy needs to detect all three.

What to fork and try

  1. Fork the SPX template and run it unmodified — then remove the breadth gate and compare.
  2. Fork the GEX fade template and observe how performance degrades during earnings weeks.
  3. Combine both: use daily mean reversion for entries, intraday GEX for exit timing.
Ready to learn?

Fork it into your workspace.

Every template in this article is one click away. Pick the one you want to play with and it lands in your workspace.