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

Examples

Example 1:

 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
A B C D E F
Date Data WMA WMA    
January 10, 2008 -0.30 -0.30 -0.30    
January 11, 2008 -1.28 -0.79 -0.86    
January 12, 2008 0.24 -0.45 -0.39 Step Weight
January 13, 2008 1.28 0.08 0.30 1 1
January 14, 2008 1.20 0.91 0.78 2 2
January 15, 2008 1.73 1.40 1.33 3 3
January 16, 2008 -2.18 0.25 0.01 4 4
January 17, 2008 -0.23 -0.23 -0.28    
January 18, 2008 1.10 -0.44 0.11    
January 19, 2008 -1.09 -0.07 -0.37    
January 20, 2008 -0.69 -0.23 -0.41    
January 21, 2008 -1.69 -1.16 -0.99    
January 22, 2008 -1.85 -1.41 -1.49    
January 23, 2008 -0.98 -1.51 -1.35    
January 24, 2008 -0.77 -1.20 -1.14    
January 25, 2008 -0.30 -0.68 -0.73    
January 26, 2008 -1.28 -0.78 -0.85    
January 27, 2008 0.24 -0.45 -0.42    
January 28, 2008 1.28 0.08 0.30    
January 29, 2008 1.20 0.91 0.78    
January 30, 2008 1.73 1.40 1.33    
January 31, 2008 -2.18 0.25 0.01    
February 1, 2008 -0.23 -0.23 -0.28    
February 2, 2008 1.10 -0.44 0.11    
February 3, 2008 -1.09 -0.07 -0.37    
February 4, 2008 -0.69 -0.23 -0.41    
February 5, 2008 -1.69 -1.16 -0.99    
February 6, 2008 -1.85 -1.41 -1.49    
February 7, 2008 -0.98 -1.51 -1.35    

Files Examples

References

Have more questions? Submit a request

0 Comments