16.20 - Simple Moving Average - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ - NewSQL Engine Analytic Functions

Teradata Database
Teradata Vantage NewSQL Engine
Release Number
Release Date
July 2019
Content Type
Programming Reference
Publication ID
English (United States)

The simple moving average (SMA) is the unweighted mean of the previous n data points. For example, a 10-day simple moving average of closing price is the mean of closing prices for the previous 10 days.

With MAvgType ('S'), the MovingAverage function uses this procedure:
  1. Compute the arithmetic average of the first window_size rows.

    The value window_size is specified by the WindowSize syntax element. In the next step, it is called N.

  2. For each subsequent row, compute the new simple moving average value with this formula:

    SMA = (V1+V2+...+VN)/N

    Vi is the value of the target column at index i in the window.