Returns the Arnaud Legoux moving average, a Gaussian-weighted average whose peak can be shifted toward recent or older bars.
ta.alma weights each bar in the window with a bell curve centred at offset * (length - 1) bars from the oldest, with width length / sigma. The weights are normalised so they sum to one.
A high offset such as 0.85 keeps the curve close to price; a low offset adds smoothing and lag. A larger sigma narrows the bell and makes the average behave like a short one inside a long window.
Syntax
ta.alma(series: series int/float, length: series int, offset: simple int/float, sigma: simple int/float, floor: simple bool) -> series floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| series | series int/ | required | Series of values to average. |
| length | series int | required | Number of bars in the window. A whole number of 1 or more. |
| offset | simple int/ | 0.85 | Position of the bell's peak from 0 (oldest bar) to 1 (newest bar). |
| sigma | simple int/ | 6 | Width control: the bell's standard deviation is length / sigma. Larger values give a narrower, more local weighting. |
| floor | simple bool | false | When true, the peak position offset * (length - 1) is rounded down to a whole bar. |
Returns
series float: the Gaussian-weighted average, or na on the first length - 1 bars.
Remarks
- The three tuning arguments are optional, so
ta.alma(close, 9)works with the usual 0.85 and 6.
Example
//@version=6
indicator("ALMA", overlay = true)
plot(ta.alma(close, 9, 0.85, 6), "ALMA", color = color.blue, linewidth = 2)
plot(ta.sma(close, 9), "SMA", color = color.gray)See also
Runs on Sidechair