Docs

ta.ewm

Smooth a series with an explicit decay factor instead of a window length.

itm
ta.ewm(source, alpha)

Exponentially weighted mean with an explicit alpha: y = alpha*source + (1 - alpha)*y[1], seeded with the first observation rather than a window average, so it has a value from the first bar. ta.ema(source, n) is this with alpha = 2/(n+1) and a full-window seed. Use this one when the decay, not the window, is what you know.

Parameters

A series parameter takes a value on every bar. A constant parameter must be known before the first bar, such as a number or an input.

NameKindTypeDefaultRangeDescription
sourceSeriesnumber--The series to read.
alphaConstantnumber0.20.000001 to 1The smoothing factor: 1 is no smoothing at all, near 0 is very heavy.

Output

NameType
valuenumber

Warm-up and missing values

Warm-up
1 bar.
Missing values
na until the first non-na observation, which seeds the recurrence. An na resets it, and the next non-na observation seeds it again.

Example

itm
ta.ewm(close, 0.2)
itm
plot(ta.ewm(close, 0.2), "Decay 0.2")