exponentialMovingAverage() function
Exponential moving average rules
- The first value of an exponential moving average over
n
values is the algebraic mean of values. - Subsequent values are calculated as
y(t) = x(t) * k + y(t-1) * (1 - k)
, where:y(t)
is the exponential moving average at timet
.k = 2 / (1 + n)
.
- The average over a period populated by only
null
values is . - Exponential moving averages skip
null
values.
Examples
Calculate a five point exponential moving average
Table transformation with a two point exponential moving average
Input table:
Query:
Output table:
_time | tag | _value |
---|---|---|
0002 | tv | 10 |
0003 | tv | 16.67 |