In this post I test nine different moving averages in order to see which is the best moving average for trading. Two different strategies and markets are tested. The results may surprise you.
What are moving averages?
Moving averages plot the average price of a security over a set number of periods or days and they’re an extremely popular tool used by traders to determine the overall trend.
Moving averages smooth past price data so traders can more objectively see the recent trend. They filter out the noise which makes it much easier to see what direction a market is heading.
Moving average crossovers
The most common way to use moving averages is to look for moving average crossovers and this technique has been used by many successful trend followers.
When a fast moving average (such as a 5-day MA) crosses over a slow moving average (such as a 20-day MA) it signals a new uptrend is taking place and is a bullish signal for a trend follower, telling them to buy the market.
When the fast moving average crosses back under the slow moving average, it signals that the uptrend has come to an end and a new downtrend is in place. This is a bearish signal for a trend follower, telling them to close their long trade or go short the market.
The biggest problem with moving averages
The biggest problem with moving averages (like all technical indicators) is that they are lagging indicators.
Since they make a calculation based on previous price data, they can only ever tell you what has happened in the past and not the future. The longer the look-back (or number of days/periods used in the calculation) the more lagging the indicator will be.
For example, a 5-day moving average will be a lot more responsive to recent price moves than a 200-day. However, because of this, a 5-day moving average will also have considerably more noise, negating the effect of the moving average in the first place.
Thus, all moving averages are a trade-off between noise and lag. Faster MA’s respond to new trends quickly but they show more noise and lead to more whipsaws. Slower MA’s are better at smoothing noise but they can be late to find new trends.
Different types of moving averages
Because of this trade-off between noise and lag, a number of traders have attempted to improve on the simple moving average calculation.
The simple moving average is fairly easy to calculate and so the indicator is carried by nearly all trading platforms. Nowadays, all you need to do is click a button and the moving average can be plotted onto your price chart.
However, by making the calculation more complex, many developers have attempted to come up with faster and smoother versions, designed to better track trends.
In the rest of this article, I shall go through nine different types of moving averages and then we shall put them to the test on historical stock market data to see which one is best.
Shows first 8 moving averages plotted together
Exponential moving average (EMA)
We have already seen how the simple moving average is calculated so the next most popular moving average is known as the exponential moving average (EMA).
The exponential moving average works in the same way as the simple moving average but it gives greater weight to more recent price moves. (More recent price data is weighted in an exponential fashion).
It is therefore able to react faster to new trends but could therefore lead to more whipsaws. The EMA is also very popular and available on nearly all trading and technical analysis platforms.
Double exponential moving average (DEMA)
As the name suggests, the double exponential moving average (DEMA) is a faster version of the exponential moving average. Although the calculation is actually based on both a simple MA and a double EMA.
The indicator was first developed by Patrick Mulloy in a February 1994 article of Traders magazine. The most important thing to note is that this is a moving average that reacts quickly to new price moves.
Triple exponential moving average (TEMA)
Like the DEMA, the triple exponential moving average (TEMA) was also developed by Patrick Mulloy. It is formed from the composite of an EMA, a DEMA and triple EMA. As such, it significantly reduces lag and reacts quickly to new price moves.
The TEMA can be so quick that it can also overshoot the market, which means it sometimes goes too far and moves beyond the recent price action. This is another downside to using fast MAs.
Wilders moving average (WILDERS)
The Wilders moving average was developed by J. Welles Wilder in his 1978 book: New Concepts In Technical Trading Systems. The indicator is calculated by altering the original exponential moving average formula.
Instead of using the original formula EMA% = 2/(n+1), where n is the number of days, Wilders uses a slightly different calculation with an EMA% of 1/14. The upshot of this is that the Wilders moving average is slightly slower than the EMA but faster than the SMA. With this formula, a 27-day WMA is equivalent to a 14-day EMA.
Weighted moving average (WMA)
The weighted moving average (WMA) is designed to find trends faster but without whipsaws. It’s calculated by multiplying each data point by a different ratio and then takes the sum of all those products. This makes it faster than the typical EMA.
The calculation is quite complex, using the formula n/d, where n is the day numerator and d is a triangular number. You can see how it works here.
Least squares moving average (linear regression)
The least squares moving average is sometimes called an end point moving average and it’s based on linear regression. In essence, the linear regression line is projected forward indicating what would happen if the regression continued forward. You can see it’s calculation here.
Hull moving average (HMA)
The Hull moving average (HMA) was developed by Alan Hull in a bid to create a moving average that was fast, responsive and with reduced lag. According to Hull, the HMA “almost eliminates lag altogether and manages to improve smoothing at the same time.”
The HMA is fairly complex to calculate so you can read more about the method here. This is a moving average that is rarely found on popular trading platforms but is considered by some to be a very good indicator.
Guppy multiple moving average (GMMA)
The Guppy multiple moving average (GMMA) is different to the other MAs discussed here because it is a combination of several exponential moving averages at once. Since it may interest readers, I will test the GMMA method as well but in a different way to the others. So I will be going long when the close crosses the GMMA.
For the test, I will be using the following EMA parameters: 3, 5, 7, 10, 12, 15 and 30, 35, 40, 45, 50, 60. As shown in the chart below:
Which is the best moving average?
Now that we have discussed the different moving averages we can start putting them to the test to see which moving averages are most effective at finding and trading trends.
It should be noted at this point that the tests are not designed to find the perfect settings but to get a rough idea as to which moving averages work best.
Two different test will be run, a long-only, moving average crossover comparison on the S&P 500 Index, and a portfolio test.
1. S&P 500 crossover test
The rules of this test are simple.
We will buy the S&P 500 whenever the faster moving average crosses over the slower moving average, indicating an upward trend. We will sell our position when the fast moving average crosses back under.
For each moving average type, two different crossovers will be tested – the 5-day/20-day crossover and a longer, 50-day/200-day crossover (also known as a golden cross). In the case of the Guppy multiple moving average, we will buy the S&P 500 when the close crosses over every moving average line and sell when the close crosses back under every line.
Starting capital will be set at $10,000 and commissions will be $0.01 per share. Position size will be 100% with no leverage. The ticker used will be $SPX from Norgate Premium Data and the test will be run from 1/1/2000 to 1/1/2015. All moving averages will be calculated using the close price and entries/ exits will be made on the next day open (after a crossover takes place).
Hopefully this will lead to some interesting results.
S&P 500 crossover results
As you can see from the table, the best moving average for a 5/20 day crossover happened to be the Wilders moving average. The Wilders MA produced a compounded annualised return of 2.11% with a maximum drawdown of -33% giving a CAR/MDD ratio of 0.06. The worst performing average was in fact the Hull moving average.
Looking at the 50/200 day crossover, the best moving average was the exponential moving average (EMA) which gave a annualised return of 5.96% with a maximum drawdown of -17%. The worst performing moving average was tied between the Hull moving average and the least squares moving average.
2. S&P 100 portfolio test
This test will be the same as above except we will be running a 10-position long only portfolio system and our watch-list will be the S&P 100 universe of stocks (which includes historical constituents).
Whenever the fast MA crosses the slow MA on a stock in the universe, we will buy it and add it to the portfolio. Whenever it crosses back under, we will sell the stock and it will drop off the portfolio. Entries/exits will be made on the next day open and duplicate signals will be ranked by the RSI(14) indicator (strongest stocks preferred first). In addition, the stock must be priced over $2.
Commissions will be set at $0.01 per share and our starting equity will be split equally between each position (equal weighted portfolio).
S&P 100 portfolio test results:
As you can see from the table, the best moving average for a 5/20 day crossover was the exponential moving average (EMA) which gave a compounded annualised return of 3.6% and a maximum drawdown of -34%, resulting in a CAR/MDD of 0.11.
The worst performing moving average was the least squares.
Looking at the 50/200 crossover, the best performing moving average was the double exponential moving average (DEMA) with a CAR/MDD ratio of 0.29 and an annualised return of 9.89%. The worst performer was the GMMA strategy.
When looking at the range of results, it’s clear that we can come to two conclusions. Firstly, longer term moving average crossovers work better than short-term crossovers. This is likely because they produce fewer whipsaws.
Second, newer and more complex moving averages appear to be no better at finding trends than the more traditional moving averages.
No doubt indicator developers will insist that their parameters be changed, to better reflect how their product is intended to be used. There may be some truth to that. Indicators such as GMMA and least squares are not necessarily intended to be used in this manner.
However, altering the parameters in such a way could be construed as curve-fitting and would lead to unreliable analysis.
Personally, the conclusions confirm what I thought all along. Simple moving averages work just as well as complex ones at finding trends, and the trusted, exponential moving average is best.
You may also like:
Thank You For Reading
Joe Marwood is an independent trader and the founder of Decoding Markets. He worked as a professional futures trader and has a passion for investing and building mechanical trading strategies. If you are interested in more quantitative trading strategies, investing ideas and tutorials make sure to check out our program Marwood Research.
This post expresses the opinions of the writer and is for information or entertainment purposes only. It is not a recommendation or personalised investment advice. Joe Marwood is not a registered financial advisor or certified analyst. The reader agrees to assume all risk resulting from the application of any of the information provided. Past performance, historical or simulated results are not a reliable indicator of future returns and may not account for real world settings. Financial trading is full of risk and margin trading can lead to financial losses totalling more than what is in your investment account. We take care to present accurate analysis but mistakes in backtesting and presenting of analysis regularly occur. Please read the Full disclaimer.
Thank you to everyone who takes the time to leave a comment. Your feedback, constructive criticism and identification of mistakes is welcome. In order to concentrate on work I may not have time to respond to all comments.