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.
- 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.
- 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.