The Moving Average – the most basic of all indicators – and probably the most used indicator around in some form or fashion. There are literally dozens and dozens of Moving Average types to choose from – but they all have a few things in common.
- All moving averages for trading use a series of values. Even though these values can be from any numeric series, the Close from a series of price bars is most commonly used and will be assumed going forward in this article.
- All moving averages define the number of prices or bars to include in the calculation. This is many times called the Length, or Period or Lookback.
- All moving averages are lagging indicators.
The idea of using a lagging indicator may sound inferior, however that is not an accurate assessment. The lagging attribute of a moving average can help a trader stay in a trade longer by smoothing out the price action noise that can cause knee jerk reactions. THAT is a good thing.
I will try to enumerate and discuss all of the Moving Averages I come across, but first, let’s start at the beginning. The simplest, ,most basic moving average of all – the Simple Moving Average.
Simple Moving Average
We all know the Simple Moving Average (SMA). It takes the Close from a define range of bars (the Length), adds them together, and then divides the result by the Length. For example, with x representing the Length:
SMA(x) = (close[x] + close[x-1] + close[x-2] + . . . + close[x-x]) / x
It’s that simple! And make note that all the Closes are equally weighted. In other words, each price point impacts the result equally.
The chart above shows examples of the 8, 50, and 200 Simple Moving Averages which are perhaps the most widely used periods. It is said when the 50 SMA crosses above the 200 SMA it is called the Golden Cross – whereas when the 50 SMA crosses below the 200 SMA it is called the Death Cross.
Weighted Moving Average
Remember that the Simple Moving Average had equal weighting for each of its Closes? Well that is what makes the Weighted Moving Average (WMA) different – each Close is weighted with the most recent bar having the most weight. The weighting mechanism first multiplies each Close by the number of bars away from the oldest bar in the period (1 to 10) and adds them together for a WeightedSum. For instance, with a WMA length of 10, the 10th bar in the series would be multiplied by Length (10) times 1 and the current bar would be multiplied by Length (10) times 10. So the current bar has the most weight.
Now to average out the weighting, we add together the digit position of the number of bars in the series from 1 to 10 (1 +2+3+4+5+6+7+8+9+10) and uses it to divide into the WeightedSum for the WMA result. Here is example code for the WMA:
for Value1 = 0 to Length – 1
WeightedSum = WeightedSum + ( Length – Value1 ) * Close[Value1] ;
CumulativeWeights = ( Length + 1 ) * Length * .5 ;
WMA = WeightedSum / CumulativeWeights ;
This calculation divides the weighting across the bars on a consistent incline towards the most recent bar which has the most weight. Below is a chart comparing the WMA with the SMA.
Notice the WMA seems to react a little faster than the SMA. This doesn’t make it better, it is simply a different way to analyze the chart.
Exponential Moving Average
It has been said that the Exponential Moving Average (EMA) is one of the most reliable moving averages to use for day trading. Like the Weight Moving Average, the EMA is also weighted – but calculates the weighting in a different way.
The EMA calculation first creates a “Weighting Factor” based on the Length:
WeightingFactor = 2 / (Length + 1);
The first EMA calculation simply begins with the Close of the starting bar. To continue the EMA for subsequent bars, we take the difference between the current Close price and the previous EMA and multiply that by the WeightingFactor. We then add to that the previous EMA for the final result.
EMA[current] = EMA[previous] + WeightingFactor * (Close – EMA[previous]);
In the chart below, we show a comparative study.
The chart compares the EMA with the previous moving averages we discussed (SMA and WMA). You will notice that the EMA has a slightly different action – a bit faster reaction than the SMA and not as tight to price as the WMA. Many times it plots in between the two.
About That Weighting
As mentioned in the previous sections, the WMA and EMA are weighted averages. However, the SMA is not weighted at all – and each of the bars within its define Length or Period are given equal weight in coming up with the resulting average as shown below.
The chart shows a 10 period SMA and the impact each of the bars within the period have on the result – with 1 being the current bar. Each bar is given equal representation – 10% each of 10 bars.
However, what about the WMA and the EMA?
The WMA re-evaluates each period for every bar giving the most recent bar the highest weight. The weighting algorithm that the WMA uses declines the weighting consistently to the end of the period each and every bar as shown below.
Noting that 1 is the current bar, you will notice the weighting has a consistent and straight decline to the last bar in the series. Even though each bar has different weighting, all the percentages of weight added together still add up to 100% showing that the resulting WMA is based solely on the 10 bars of the define period.
However, the EMA is a different beast. In the previous section, you may have noticed from the calculation that the Length is only used to calculate the WeightingFactor AND the resulting value uses the previous EMA calculation to create the new EMA. This means that even thought a Length has been defined, it does not mean that the result is totally based on just the last 10 bars like the SMA or WMA. Rather, the EMA uses the residual results of past EMA values vs the current price – previous EMA values going back since the beginning of the chart, albeit in only minute amounts for the older bars. Because of this, the resulting EMA value is based only partially on the bars from the defined period by about 86.8%. One would have to go out over 2 times the period before we start approaching close to 100% and older bars would have little to no effect. Here’s a chart showing the weighting for a 10 period EMA.
The weight distribution is similar to the WMA except the columns have a descending exponential curve from the current bar (1) and continues until it simply doesn’t exist anymore. For a 10 period EMA, the weight of the current bar is 18.18% and it goes down from there. In fact, the weight of each bar (for a 10 period EMA) is 18.18% less than the next one.
OK, So Which Is Better
After going thought this study of the three most used moving averages, it might not surprise you if I say that one of them is not better than the others. They are simply different, but each has their pros and cons.
The SMA is an equal weighted moving average that is quick to calculate and is used perhaps more than any other moving average. It’s the original! The SMA tends to lag more than most other moving averages, but that can actually help you stay in a trade longer by avoiding the noise and whipsaws of the market.
The WMA is much quicker to react to market changes than the SMA. Being quicker can help make quicker decisions, but quicker also reveals more noise. The WMA is probably used less than either the SMA or EMA.
And the EMA seems to be in the middle – the Goldilocks of the group – faster than the SMA and a bit more lagging than the WMA.
The best thing to do is try all three on the charts you like to use and see which one feels right – and then stick to it so you will be able to learn how it moves with the market.
A Period for All Markets
So which Period or Length should be used with these moving averages? It has been said that there is a moving average for every marker – you can curve fit any average to work. However, there are typical moving averages that are used in the market place.
For the SMA, the 50 and 200 period averages are fairly global in use. In fact, when the 50 SMA crosses above the 200 SMA, that is referred to as the Golden Cross showing a bullish trend is ahead. However, when the 50 crosses below the 200, that is called the Death Cross denoting a bearish trend is happening. The SMA is also used inside many indicators including the Bollinger Bands, Keltner Channel, RSI etc.
For some reason, I have noticed that most of the EMA periods I have seen used are based on Fibonacci numbers (3, 5, 8, 13, 21, 34, 55, etc). Many believe the 34 EMA is a strong moving average. The EMA is also the moving average of choice for the MACD indicator and sometimes the Stochastic.
It should also be noted that SMAs can have equivalents across different timeframes. For instance, if you have a 5 SMA on a 60 minute chart – you can use a 20 SMA on a 15 minute chart to see equivalent MA/price crosses – almost like having a closeup version. Simply multiply the period used in the 60 minute chart by 4 since there are four 15 minute segments in 60 minutes. You can do this with any timeframe equivalents – but it will not work as accurately when using WMAs and EMAs.
OK, So How Do I Use Them?
There are a few techniques for using moving averages.
Price Cross – some like to enter or exit a trade when price closes above or below an particular moving average. Since price can change so frequently, some let the price close twice above or below as a confirmation before making a trade commitment. Popular moving averages to use for this method are typically the 5 or 8 SMA and EMA. Depending on how long you want to stay in a trade, the 13 or even 21 have been used to determine a trade decision.
MA Cross – Given the lagging quality of moving averages, some like to enter a trade when a moving average with a small period (Fast) crosses above or below a moving average with a larger period (Slow). Since these moving averages smooth out the noise, it is believed that trend changes are fairly reliable for the MA Cross. Popular pairs for MA Crosses are:
- 8 and 20 SMAs
- 10 and 30 SMAs
- 8 and 13 EMAs
- 50 and 200 SMAs (Used for overall trend direction)
MA Alignment – When you have multiple moving averages on your chart, you can determine the overall direction of the market by ensuring that all of the moving averages are “stacked” in the proper order. For instance, if you have three moving averages and they are stacked with the fastest on top and the slowest at the bottom (8, 20, 50), then the market will be bullish. If the stack is reversed (50, 20, 8) then the market is bearish. If the moving averages are out of alignment from each other, then the market could either be in an accumulation/distribution mode (flat and choppy) or going through a reversal.
There is actually no conclusion as there are so many other types of moving averages out there to discuss. But those will be save for other articles.