Bollinger Bands
A moving average with bands set by how much price has been varying.
Bollinger bands: middle = SMA(x, period); upper / lower = middle ± mult × σ, σ the population standard deviation (÷ period) of the same window (current candle included). Ready at period candles.
Settings
| Setting | Default | Range | What it does |
|---|---|---|---|
| period | 20 | 1 to 500 | Candles in the average and the deviation. |
| mult | 2 | 0.1 to 10 | Band distance in standard deviations. |
What it gives
| Output | What it is |
|---|---|
| Middle band | The SMA. |
| Upper band | Middle + mult × σ. |
| Lower band | Middle − mult × σ. |
What it reads
It reads open, high, low, close, hl2, hlc3, ohlc4, hlcc4, close by default.
Warm-up
With its default settings, Bollinger Bands needs 20 closed candles before its first value. A backtest loads them before its start date, so the first trade can already use it.
Related indicators
Used to build: Bollinger %B, Bollinger Band Width, TTM Squeeze
Test it
Copy this sentence into the Algonney chat to backtest it:
Backtest a strategy on BTC that uses Bollinger Bands with its default settings