ta.ema
Follow price with an average that gives recent bars more weight than old ones.
ta.ema(source, length)Exponential moving average, alpha = 2/(length+1), seeded with the simple average of the first full window.
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.
| Name | Kind | Type | Default | Range | Description |
|---|---|---|---|---|---|
source | Series | number | - | - | The series to read. |
length | Constant | number | - | 1 to 10000 | Window in observed bars. |
Output
| Name | Type |
|---|---|
value | number |
Warm-up and missing values
- Warm-up
lengthbars. Names in the warm-up are this operator’s parameters.- Missing values
- Returns na until
lengthconsecutive non-na observations are in the window. An na resets the accumulation.
Example
ta.ema(close, 20)plot(ta.ema(close, 20), "Exponential 20")