ALMA

A smooth moving average that weights recent candles along a bell curve to cut lag and noise.

Arnaud Legoux moving average over the last period candles (current included): Gaussian weights w(i) = exp(−(i − m)² ÷ (2s²)), i = 0 for the oldest, m = offset × (period − 1), s = period ÷ sigma. Ready at period candles.

Settings

SettingDefaultRangeWhat it does
period91 to 1000Candles averaged.
offset0.850 to 1Centre of the weights: 0 = oldest, 1 = newest.
sigma60.1 to 100Sharpness: larger = narrower weights.

What it gives

OutputWhat it is
almaThe average, in price.

What it reads

It reads open, high, low, close, hl2, hlc3, ohlc4, hlcc4, close by default.

Warm-up

With its default settings, ALMA needs 9 closed candles before its first value. A backtest loads them before its start date, so the first trade can already use it.

Test it

Copy this sentence into the Algonney chat to backtest it:

Backtest a strategy on BTC that uses ALMA with its default settings