Arnaud Legoux moving average

almamoving_averagesForge API 1

Gaussian weighted average whose peak you can move toward the newest bar.

Inputs

NameTypeDefaultRange
sourcesourceclose
windowint91 to 5000
offsetfloat0.850 to 1
sigmafloat60.5 to 50

Outputs

NameTypeRequiredDescription
almavalueOptionalcolor theme.accent, style line, width 1
Warm-up
window - 1 bars (8 at the defaults)
Repaints
No
Parity
None

Formula

m = offset * (window - 1), s = window / sigma

w[k] = exp(-(k - m)^2 / (2 * s^2)), k = 0 for the oldest bar of the window

ALMA[i] = sum(w[k] * x[i-window+1+k]) / sum(w[k])