Mean reversion strategy: rules, edge and the trend trap
Mean reversion is the bet that price, after stretching too far from its average, snaps back. It is the opposite of trend following and powers many quant and grid systems. The edge is real in calm, range-bound markets — and it can be brutally destroyed by a single strong trend. This guide covers the rules, the math, and the risk.
The core idea
Mean reversion assumes that extreme moves are partly noise and that price will revert toward a "fair" value — usually a moving average. When price drops well below average, a reversion trader buys, expecting a bounce; when it spikes above, they sell. The strategy wins many small trades in choppy markets, which is the opposite profile of momentum trading, which wins a few big trades and loses many small ones.
The z-score entry
A clean way to define "too far" is the z-score: how many standard deviations price sits from its moving average. A common rule enters long when the z-score falls below −2 and exits when it returns toward 0. This is exactly what the lower Bollinger Band represents visually. The z-score makes the rule adaptive — the threshold scales with volatility instead of being a fixed dollar distance.
The trend trap
The strategy collects small, frequent profits and occasionally takes one enormous loss when a market trends hard and never reverts. Buying every dip in a crash is the textbook way to blow up an account. The fix is a hard stop-loss and a regime filter that disables reversion when a strong trend is detected — accepting that you will sit out some range trades to avoid catastrophe. Learn how to size for it in position sizing.
The code
python · reversion.pyimport statistics as st
window = closes[-20:]
mean = sum(window)/20; sd = st.pstdev(window)
z = (price - mean) / sd if sd else 0
if z < -2 and not strong_trend: signal = 'buy'
elif z > 0: signal = 'exit'
Always backtest reversion across both calm and trending periods in the backtester. A backtest that only covers a sideways year will wildly overstate the edge.
Frequently asked questions
What is a mean reversion strategy?
It is a strategy that buys when price falls well below its average and sells when it rises above, betting that price reverts toward the mean. It wins frequent small trades in range-bound markets and is the opposite of trend following.
Why does mean reversion blow up?
Because it collects small profits and occasionally takes one huge loss when a market trends and never reverts — buying every dip in a crash. A hard stop-loss and a trend filter are essential to survive.
What is a good z-score threshold for entries?
Many traders use −2 to enter longs and 0 to exit, but the right threshold depends on the market and timeframe. It should be chosen by robust out-of-sample testing, not curve-fitting to a single period.
Is mean reversion better than trend following?
Neither is better universally. Mean reversion thrives in ranges and suffers in trends; trend following is the reverse. Many systematic traders run both so one profits when the other struggles.