Strategy · Mean reversion
Bollinger.
Buys when the price falls below its lower band and shorts when it rises above the upper one: it fades extremes.
The rule
- The bands are the moving average plus and minus a number of standard deviations of the close over the same window.
- Long while the close is below the lower band, short while it is above the upper band.
- Flat as soon as the close is back inside, which is most of the time.
It is the opposite stance to momentum on purpose. Running the two on the same data is the quickest way to see how much a result depends on which question the rule asks.
Every signal is acted on at the next day's close, never the close it was computed from. Skipping that one-day shift is the most common way a backtest invents returns (why).
Parameters
| Parameter | Default | What it does |
|---|---|---|
| Window | 20 days | Window of the average and of the standard deviation. |
| Band width | 2σ | How many standard deviations the bands sit from the average. |
What validation tries
Walk-forward validation picks the best of these 12 combinations on the first 70% of the period, then scores only that one on the remaining 30%. The fewer combinations, the less room to find one that fit by luck.
- 10 days · 1.5σ
- 10 days · 2σ
- 10 days · 2.5σ
- 20 days · 1.5σ
- 20 days · 2σ
- 20 days · 2.5σ
- 30 days · 1.5σ
- 30 days · 2σ
- 30 days · 2.5σ
- 50 days · 1.5σ
- 50 days · 2σ
- 50 days · 2.5σ
How it did on AAPL
From the write-up: the same three strategies on Apple, 10 bp costs, with the 70/30 split. The best in-sample combination on the first window was window 50 / 2.5σ. Moving the end date one year moves the split, and the verdict can flip.
| Test period ends | In-sample Sharpe | Out-of-sample Sharpe | Verdict |
|---|---|---|---|
| 2023 (2018–2024 run) | 0.558 | 1.169 | held up |
| 2024 (2018–2025 run) | 0.686 | −0.157 | failed |
Hypothetical results on past data, re-run by a script in the repository. Not a recommendation to trade this or any strategy.
Where it misleads
Mean reversion earns in chop and sells every rally in a sustained uptrend. Because it is flat most of the time, few trades decide its result, and on AAPL its entries could not be told apart from shuffled ones (permutation test, p 0.066).
More on reading a result like this: how to tell if a backtest is overfit.
Run it yourself
The same set-up, AAPL from 2018 to 2024, opens in the workspace with this strategy's defaults, straight after sign-up if you are new. Change the ticker or the dates and the Validate tab runs the same checks.
The same rule on other stocks: 39 US and Indian stocks. The other strategies: Momentum · MACD. Head to head: Momentum vs Bollinger bands · MACD vs Bollinger bands.