Arnaud Legoux moving average
All indicators

LibraryTrend

Indicator

Arnaud Legoux moving average

Arnaud Legoux's moving average: a bell shaped weighting moved towards the newest bars, meant to be smooth and responsive at once.

TrendOn the price4 inputsALMA

How it is calculated

Each bar of the window weighs exp(-(i - m)^2 / (2 s^2)), with i from 0 for the oldest bar to length minus 1 for the newest, m = offset times (length minus 1) and s = length / sigma. The weighted sum of the prices is divided by the sum of the weights. The first value comes once length bars are in.

Reference: Legoux 2009

How to read it

The offset moves the peak of the weighting: near 1 the line follows price closely, near 0 it is smooth and slow. A larger sigma narrows the bell, so fewer bars matter. Slope and the side price is on are read as with any average.

In a strategy

A responsive trend line, ctx.ind("alma", length=9, offset=0.85, sigma=6), or the cross of two ALMAs of different lengths as entry signal.

Inputs

InputTypeDefaultRange or choices
LengthlengthWhole number9min 1, max 5000
OffsetoffsetNumber0.85min 0, max 1
SigmasigmaNumber6min 0.5, max 50
SourcesourcePrice"close"close, open, high, low, hl2, hlc3, ohlc4, hlcc4

What it draws

LineDrawn as
ALMALine

Used in

No strategy template reads it yet.

OrionQuant