Indicator Formula

Technical Details — Arnaud Legoux Moving Average (ALMA)
Section titled “Technical Details — Arnaud Legoux Moving Average (ALMA)”Overview
Section titled “Overview”The Arnaud Legoux Moving Average (ALMA) applies Gaussian-distribution weights to prices within the lookback window. The offset parameter (0-1) controls where the peak weight falls (0 = oldest, 1 = newest, 0.85 = default), and sigma (1-10) controls how concentrated the weights are.
Mathematical Derivation
Step 1 — Calculate Weight Position
Section titled “Step 1 — Calculate Weight Position”Purpose: Determine the center of the Gaussian bell curve.
$$m = offset \times (n - 1)$$
Where:
- $$offset$$ = Weight position parameter (0 to 1, default 0.85)
- $$n$$ = Period
What This Measures: Where in the window the highest weight is applied
Step 2 — Calculate Weight Spread
Section titled “Step 2 — Calculate Weight Spread”Purpose: Determine how concentrated the weights are.
$$s = \frac{n}{\sigma}$$
Where:
- $$\sigma$$ = Sigma parameter (1 to 10, default 6)
What This Measures: How quickly weights decay away from the peak
Step 3 — Calculate Gaussian Weights
Section titled “Step 3 — Calculate Gaussian Weights”Purpose: Generate bell-curve weights for each bar.
$$w[i] = e^{-\frac{(i - m)^2}{2s^2}}$$
Where:
- $$i$$ = Bar index within the window
- $$m$$ = Peak position
- $$s$$ = Spread
What This Measures: The relative importance of each bar in the calculation
Step 4 — Apply Weighted Average
Section titled “Step 4 — Apply Weighted Average”Purpose: Calculate the final ALMA value.
$$ALMA[t] = \frac{\sum_{i=0}^{n-1} w[i] \times Close[t-n+1+i]}{\sum_{i=0}^{n-1} w[i]}$$
What This Measures: Gaussian-weighted average price
Compact Formula Summary
$$m = offset \times (n-1)$$ $$s = n / \sigma$$ $$w[i] = e^{-(i-m)^2 / 2s^2}$$ $$ALMA[t] = \frac{\sum w[i] \times Close[i]}{\sum w[i]}$$
Default Parameters: Period = 14, Offset = 0.85, Sigma = 6
Complete Calculation Example
With Period = 5, Offset = 0.85, Sigma = 6:
- m = 0.85 × 4 = 3.4 (weight peaks near the most recent bar)
- Weights concentrate around bar index 3-4, giving most influence to recent prices
- Result: smooth average that responds quickly to price changes
Key Takeaways from the Example
- Gaussian Weighting: Unlike linear weights (WMA) or exponential (EMA), ALMA uses a bell curve for the most mathematically elegant smoothing
- Three Parameters: Period, Offset, and Sigma give fine-grained control over responsiveness
- Offset Control: Offset = 0.85 means 85% of the weight window is behind the peak — emphasizing recent data
- Sigma Control: Lower sigma = more concentrated weights (responsive), higher sigma = more spread out (smooth)