Hinweis:Dieser Abschnitt ist nur in englischer Sprache verfügbar. Wir bitten um Ihr Verständnis.
3.5.2.9 Emovavg
Contents
Description
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.
- Method I: starts from point = n
- Method II: starts from point = 1
Syntax
vector emovavg(vector vd, int n[, int method=0])
Parameters
vd
- The data vector used to calculate exponential moving average.
n
- is the timeperiod.
method
- is the method controller.If we set method = 1, then we use Method II described above. And by default method = 0, which means using Method I.
Return
Return the exponential moving average vector.
Example
// 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