Bollinger Bands (volatility envelope)
A moving average (SMA-20) ± k standard deviations. The bands breathe with volatility. Touches of the outer bands count as extremes — the basis for mean-reversion or breakout logic.
What are Bollinger Bands?
Developed by John Bollinger in the 1980s. Three lines that span a statistically "normal" price range:
Middle = SMA(close, period) # usually 20
Upper = Middle + k · stdev(close, period) # k usually 2.0
Lower = Middle − k · stdev(close, period)
Because the width comes from the standard deviation, the bands expand in volatile phases and contract in calm ones. Under a normal-distribution assumption ~95% of prices would lie within ±2σ — in reality less, due to fat tails, especially in crypto.
Two opposite uses
- Mean reversion: price outside the band = extreme → a return to the middle is likely (works in ranges).
- Breakout / squeeze: contracting bands + a breakout = the start of a trend (works in trends).
Which one works depends on the regime — the central weakness of naive Bollinger systems.
How Botty uses Bollinger
- Bands as parametric cache series:
data/indicator_cache.py(bb_sma,bb_std). - Entry
bb_extreme(strategies/conditions/entries.py): previous close outside the band, current close back inside → mean reversion. Deliberately a range entry — to be paired withrange_filter(max ADX). - Full strategy docs: Bollinger Band Mean Reversion.
Crypto note
On 1h BTC, price often "rides" the bands during a trend, i.e. 20/2.0 produces too many false signals. Often better: 20/2.5 or 50/2.0, combined with a range filter.