Mmovavg
Contents
Description
This function is for calculating modified moving averages. Average value at the starting point = n is calculated by Movavg function, and then other points are calculated by formula similar to Emovavg function with weighting factor
.
/math-4a0e3da95bbfbeb1f47ce7cdfa5544f6.png)
where
is the nth point calculated by movavg(x, n-1,0).
Syntax
vector mmovavg(vector vd, int n)
Parameters
vd
- The data vector used to calculate modified moving average.
n
- is the timeperiod.
Return
Return the modified moving average vector.
Example
// Col(2) will be filled with modified moving average value at each point, with stating point = 10. for(ii=1;ii<=30;ii++) col(1)[ii] = ii; col(2)=mmovavg(col(1),10);