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".
Z-score reversion on 5-day returns with breadth gate
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.
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.
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
- Fork the SPX template and run it unmodified — then remove the breadth gate and compare.
- Fork the GEX fade template and observe how performance degrades during earnings weeks.
- Combine both: use daily mean reversion for entries, intraday GEX for exit timing.
Related tutorials
How to read a backtest report without fooling yourself
A checklist for evaluating any strategy you did not write yourself. Required reading before forking.
Mean Reversion on S&P 500 · the entry-level quant strategy
Short-term mean reversion with a z-score signal and a breadth-based regime gate. The cleanest first strategy for learning portfolio construction.
SPY GEX Fade · trading options microstructure
An intraday fade strategy built on dealer gamma exposure, executed with a 3-minute trigger. Teaches why positioning data beats price data.
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.