ta.alma()
Arnaud Legoux Moving Average
Computes the Arnaud Legoux Moving Average (ALMA), a Gaussian-kernel weighted average over length bars. Parameters offset and sigma let you tune responsiveness versus smoothness; optional floor controls window flooring behavior.
Syntax
ta.alma(series, length, offset, sigma, floor) → series floatArguments
| Parameter | Type | Description |
|---|---|---|
| series | series int/float | Series of values to process. |
| length | series int | Window size for the Gaussian kernel. |
| offset | simple int/float | Controls tradeoff between smoothness and responsiveness. |
| sigma | simple int/float | Changes smoothness of the Gaussian weights. |
| floor | simple bool | Optional; default false. |
Returns
Arnaud Legoux Moving Average.
Remarks
na values in the source series are included in calculations and will produce an na result.
Code Examples
//@version=6
indicator("ta.alma", overlay=true)
plot(ta.alma(close, 9, 0.85, 6))
// same on pine, but much less efficient
pine_alma(series, windowsize, offset, sigma) =>
m = offset * (windowsize - 1)
s = windowsize / sigma
norm = 0.0
sum = 0.0
for i = 0 to windowsize - 1
weight = math.exp(-1 * math.pow(i - m, 2) / (2 * math.pow(s, 2)))
norm := norm + weight
sum := sum + series[windowsize - i - 1] * weight
sum / norm
plot(pine_alma(close, 9, 0.85, 6))Trading Applications
Use Gaussian distribution weighting for adaptive smoothing
Fine-tune responsiveness vs smoothness with offset parameter
Reduce lag while minimizing false signals
Apply in algorithmic trading systems requiring precise MA tuning
Frequently Asked Questions
Generate ta.alma() Code with AI
Skip the manual coding. Use Pineify's AI Coding Agent to generate Pine Script code using ta.alma() and other built-in functions instantly.
Related Pine Script Functions
ta.sma() - Simple Moving Average
Learn how to use ta.sma() in Pine Script. Syntax, parameters, code examples, and trading applications for the Simple Moving Average function.
ta.ema() - Exponential Moving Average
Learn how to use ta.ema() in Pine Script. Syntax, parameters, code examples, and trading applications for the Exponential Moving Average function.
ta.wma() - Weighted Moving Average
Learn how to use ta.wma() in Pine Script. Syntax, parameters, code examples, and trading applications for the Weighted Moving Average function.
ta.hma() - Hull Moving Average
Learn how to use ta.hma() in Pine Script. Syntax, parameters, code examples for the fast, low-lag Hull Moving Average.
ta.vwma() - Volume Weighted Moving Average
Learn how to use ta.vwma() in Pine Script. Syntax, parameters, code examples for the Volume Weighted Moving Average.