# 4.7 Weighted Moving Average (WMA)

## Introduction

The concept of weighted moving average comes out of the fact that the recent trend of the price action is more important to predict the immediate future course of action than the price action in the distant past.

In simple or normal moving average each closing price of the period in question is added and divided by the number of periods. To put it in simple words, each closing price is given the same importance or weight. While in weighted moving average the recent closing prices are given more importance or weight and hence the name weighted moving average or WMA.

### Example

Let’s say we are using 5-period moving average on daily chart and the closing prices for past 5 days were as follows:

Day |
1 |
2 |
3 |
4 |
5 |

Closing Price (value) |
111 |
105 |
110 |
114 |
116 |

In this case the simple moving average of today will be the sum of the above 5 values divided by 5 i.e. (111+105+110+114+116)/5 or 111.20.

Now if you observe, the day 2 had a sharp fall in the prices and then the prices started going up strongly. The price-action of past 3 days indicates that an uptrend may be coming into the picture. In such case if we give equal importance to the prices of day 1 and day 2, the result may be misleading.

Now let’s see how we can solve this issue.

Let’s again take the above example of past 5 days’ closing prices with more weight to the recent values:

Day |
1 |
2 |
3 |
4 |
5 |

Closing Price (value) |
111 |
105 |
110 |
114 |
116 |

Weight |
1 |
2 |
3 |
4 |
5 |

(Closing Price) x (Weight) |
111*1 = 111 |
105* 2 = 210 |
110*3 = 330 |
114*4 = 456 |
116*5 = 580 |

The weighted moving average will now be calculated using the following formula:

**WMA = Sum of ((Closing Prices) x (weight))
--------------------------------------
(5+4+3+2+1)**

= 112.47 which is much higher that the SMA of 111.20 and hence takes into consideration the recent rise in a better way.

**Generic Formula for weighted moving average**

If instead of 5 days example, we consider “N” days and the values for these N days as P(n), P(n-1), P(n-2) …. P(n-(n-1)) where P(n) is the most recent value then the weighted moving average would be:

**WMA (n days) =**

**N*P(n) + (N-1)*P(n-1) + (N-2)*P(n-2) + ….+ 2*P(n-(n-2)) + 1*P(n-(n-1))
-------------------------------------------------------------------------------
(N + (N-1) + (N-2) + ……. + 2 + 1)**

Now the denominator here i.e. N + (N-1) + (N-2) + ……. + 2 + 1 is nothing but N(N+1)/2 because N + (N-1) + (N-2) + ……. + 2 + 1 = N(N+1)/2. Hence the simplified formula for N days' weighted moving average is as follows:

**
N*P(n) + (N-1)*P(n-1) + (N-2)*P(n-2) + ….+ 2*P(n-(n-2)) + 1*P(n-(n-1))
------------------------------------------------------------------------------
N(N+1)/2**

Point to be noted here is that the weight has been increasing linearly and hence this type of moving average is literally a **Linear Weighted Moving Average**. This calculation approach is further improved to give birth the an EMA of Exponential Moving Average.