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

SettingDefaultRangeWhat it does
period201 to 500Candles in the average and the deviation.
mult20.1 to 10Band distance in standard deviations.

What it gives

OutputWhat it is
Middle bandThe SMA.
Upper bandMiddle + mult × σ.
Lower bandMiddle − 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