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
| Input | Type | Default | Range or choices |
|---|---|---|---|
Lengthlength | Whole number | 9 | min 1, max 5000 |
Offsetoffset | Number | 0.85 | min 0, max 1 |
Sigmasigma | Number | 6 | min 0.5, max 50 |
Sourcesource | Price | "close" | close, open, high, low, hl2, hlc3, ohlc4, hlcc4 |
What it draws
| Line | Drawn as |
|---|---|
| ALMA | Line |
Used in
No strategy template reads it yet.