Bollinger Band To Band (Mean reversion)
Buys when price closes below the lower Bollinger Band (20-bar, 2σ) and holds until it closes above the upper band — riding the oversold snap all the way across the channel.
How It Works
- Each bar, compute the 20-bar simple moving average of the close and its Bollinger Bands two standard deviations above and below.
- Buy when the close drops below the lower band — price is unusually cheap relative to its own recent range, and stretched moves tend to snap back.
- Hold through the bounce and sell only when the close rises above the upper band, capturing the full ride from one edge of the channel to the other.
Worked example. Say the 20-bar average is 100 with σ = 2, so the bands sit at 96 and 104. A close at 95.5 triggers the buy. Days later the average has drifted up to 101 and price closes at 105.5 — above the upper band — so the position is sold for roughly a 10% gain.
The Math Behind The Indicators
Everything runs on closing prices of the traded timeframe: P is a close, Pt today's close, and N counts bars — one bar is one candle of that timeframe, so 20 bars on a 1h chart is 20 hours.
- Simple Moving Average (SMA)
- The plain average of the last N closing prices: add them up, divide by N. It smooths out bar-to-bar noise so the underlying direction is easier to see — a rising SMA means recent prices sit above where they used to be.
- Example: With N = 3 and closes 100, 102, 104 the SMA is (100 + 102 + 104) / 3 = 102.
- Bollinger Bands
- A 20-bar SMA with an envelope two standard deviations above and below it. The standard deviation σ measures how far closes have recently strayed from their average, so the bands widen when the market is choppy and tighten when it is calm — a close outside a band is a statistically unusual move.
- Example: If the last 20 closes average 100 and typically stray about 1.5 from it (σ = 1.5), the bands sit at 100 ± 3, i.e. 97 and 103. A close at 96.5 is below the lower band — unusually cheap relative to the recent range.