Online calculation of Exponential Moving Average for Node.js.
Also suports Moving Variance, Moving Deviation and Forecast.
The following online algorythm is implemented:
diff := x - mean incr := alpha * diff mean := mean + incr variance := (1 - alpha) * (variance + diff * incr) forecast := mean + alpha * diff
$ npm install moving-average
var timeInterval = 5 * 60 * 1000; // 5 minutesvar MA = ;var ma = ;;