# WMA - Weighted-Moving Average

Returns the weighted moving (rolling/running) average using the previous m data points.

## Syntax

WMA(X, Order, W, T)
X
is the univariate time series data (a one-dimensional array of cells (e.g., rows or columns)).
Order
is the time order in the data series (i.e., the first data point's corresponding date (earliest date = 1 (default), latest date = 0)).
Order Description
1 Ascending (the first data point corresponds to the earliest date) (default).
0 Descending (the first data point corresponds to the latest date).
W
is the size of an equal-weighted window, or an array of multiplying factors (i.e., weights) of the moving/rolling window.
T
is the forecast time/horizon beyond the end of X. If missing, a default value of 0 (Latest or end of X) is assumed.

## Remarks

1. The weighted-moving average (WMA) is defined as: $$\mathit{wma}_t^k=\frac{\sum_{i=1}^{k} x_{t-i}\times w_i}{\sum_{i=1}^{k} w_i}$$ Where:
• $w_i$ is the weight of the i-th data point in the moving/rolling window.
• $k$ is the size of the moving/rolling window.
• $x_t$ is the value of the time series at time $t$.
2. IMPORTANT: The first value in the weights array corresponds to the latest point in the MA window.
3. In practice, the weighting factors are often chosen to give more weight to the most recent terms in the time series and less weight to older data.
4. A small window size (m) will have less of a smoothing effect and be more responsive to recent changes in the data, while a larger m will have a greater smoothing effect, and produce a more pronounced lag in the smoothed sequence.
5. The weights array should have a size greater than zero and consist of non-negative values.
6. The window size (m) must be less than the time series size, or else an error value (#VALUE!) is returned.
7. The WMA assumes a stationary time series, so if a trend exists, the WMA lags behind it.
8. This technique has the disadvantage that it cannot be used until at least k observations have been made.
9. The time series is homogeneous or equally spaced.
10. The time series may include missing values (e.g., #N/A) at either end.