This function is for calculating exponential moving averages, where the weight factors decrease exponentially. The degree of weighting decrease is defined as , where n = timeperiod. Two methods involved to start the calculation.
vector emovavg(vector vd, int n[, int method=0])
vd
n
method
Return the exponential moving average vector.
// Col(2) will be filled with exponential moving average value at each point, //with stating point = 10. // Col(3) will be filled with exponential moving average value at each point, //with stating point = 1. for(ii=1;ii<=30;ii++) col(1)[ii] = ii; col(2)=emovavg(col(1),10); //method I col(3)=emovavg(col(1),10, 1); //method II