# Tmovavg

Tmovavg-func

## Description

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 .

## Syntax

vector tmovavg(vector vd, int n)

## Parameters

**vd**

- The data vector is used to calculate triangular moving average.

**n**

- is the timeperiod.

## Return

Return the triangular moving average vector.

## Example

// 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;
col(2)=tmovavg(col(1),9);