Weighted Moving Average (WMA)

The Weighted Moving Average (WMA) is a smoothing calculation which like the Exponential Moving Average (EMA) applies greater weighting to more recient data but unlike the EMA is not cumulative.


The Weighted Moving Average (WMA) calculates a weighting factor for each value in the series (time period n). The more recent the value, the greater the assigned weight. The WMA is similar to a Simple Moving average (SMA) in that it is not cumulative, that is, it only includes values in the time period (unlike an EMA). However the WMA is similar to an EMA in that more recent data has a greater contribution to the average, meaning the WMA will follow price movement more closely than the SMA would. 

In the below graph we can see a comparison between SMA, EMA and finally the WMA for the same period. We can see that the WMA reacts in a similar way to the EMA however it is more in line with the SMA. In this graph the EMA appears to behave more conservatively than the WMA which in comparison is a little more ‘wild’ than both the EMA and SMA.


Below is the equation used to calculate the WMA graphed above.


  • Period (p) – this is the number of previous data points you want to include in the average calculation.
  • Index (i) – this is the time series index (e.g. date of current row in time series data)
  • Input (input) – this is the data value (e.g. price data of a stock).


Below is the python code to calculate the WMA. To access the maintained version of this code please see python library techind.


The below graphs shows multiple EMA indicators with varying periods against the underlying timeseries.


  • techind TestPyPi – link

About the author

Leave a Reply

Your email address will not be published. Required fields are marked *