Weighted Moving Average
So far, so good. Simple moving averages, or SMAs, smooth out the variations in day-to-day data so that we can start to see a trend. But the SMA is still susceptible to large one-day changes, and the effect of one larger than normal change will remain in the average for the number of days equal to the interval. In our examples above, an unusual daily change remains in the SMA for the next 5 days. One way to counteract these effects is to give more weight to the more recent data so that anomalies get suppressed quickly.
Enter the Weighted Moving Average, or WMA. We use the same moving interval as above, but we add in a weight factor for each day's value, with the most recent data having the most weight and each previous day's weight factor decreases. The weight factor for the most recent day's data is equal to the length of the interval. In our 5-day model, the most recent day's weight factor is 5; the next earlier day's factor is 4, and so on down to a weight factor of 1 for the last day in the interval. The weight factor is multiplied by that day's value; that is how the most recent data gets more "weight" in the computed average. Let's recompute the above averages using our new weight factors:
WtAvg(Day5) = ((1 * 17.32) + (2 * 18.81) + (3* 18.77) + (4 * 19.42) + (5 * 20.83)) / (1 + 2 + 3 + 4 + 5)
= (17.32 + 37.62 + 56.31 + 77.68 + 104.15) = 293.08 / 15 = 19.539
Notice that we divided the sum of the weighted values by 15 and not 5; what's the deal? When we multiplied Day5's value by 5, we effectively put that value in 5 times; we put Day4's value in 4 times, and so on. We really didn't have 5 values to average, we had 5+4+3+2+1 values, or 15 values. So, we had to divide the sum of the weighted values by the sum of the weight factors, or 15.
This method gives decreasing contribution to earlier values; the first day's value only counts once while the last day's value counts five times. But there is a more significant effect. Notice in WtAvg(Day5) example, Day2's value (18.81) counted twice (2 * 18.81), but in WtAvg(Day6), Day6's value counted only once. So not only does early data contribute less in a WMA, as the average progresses, each previous day's contribution contributes less while the most recent data always counts the most. If there is a unusually large change in one day's value, that day's value will contribute successively less as the average progresses, diminishing that aberration more quickly than in the SMA.