This function is for calculating triangular moving averages. In fact, this function equals to using function Movavg twice with backward and 0 forward. Thus, at point = i, the triangular moving average value is:
where and .
vector tmovavg(vector vd, int n)
Return the triangular moving average vector.
// Col(2) will be filled with triangular moving average value at each point,
//with stating point = 9.
for(ii=1;ii<=30;ii++) col(1)[ii] = ii;