Wednesday, July 31, 2024

SMA vs. EMA: Understanding and Using Moving Averages for Trading Success

The Moving average is probably the most common used indicator in the trading world. It is easy to understand and to calculate and therefore a good indicator to begin with. Most traders put it on their charts without thinking about it. I think that is a mistake, you should understand everything that is on your chart, or it shouldn’t be there.

In this article I will show how to calculate and use the Simple Moving Average (SMA) and the Exponential Moving Average (EMA). They are similar but not equal.

Difference Between the SMA and the EMA

The SMA is equally weighted, every price value has the same impact on the average. That is not so for the EMA, where more weight is given to the more recent and less to the older price data. That is why the EMA is called a weighted moving average.

This makes the EMA more responsive to changes in price while the SMA is slower to react. In turn this makes the SMA line smoother. Both have their advantages and disadvantages as we will get to later.

Calculating the Simple Moving Average (SMA)

This is probably the easiest calculation you will find in finance. You simply take the average for the past n days and then move the average as they days go by. If we want to calculate a three day moving average in Excel it would look like this:

 


Calculating the Exponential Moving Average (EMA)

This is not as straight forward as calculating the SMA. The formula for calculating the EMA is:



With the boring math formula out of the way, we can get on to the actual calculation. But you may have noticed something: in the formula, EMA is used to calculate the EMA! How can we plug in a value of the EMA into the formula when we are trying to calculate the EMA?

Well, we can’t, so we have two options. For the very first calculation, we can either calculate the SMA of the previous n values or simply use the very first price value. It really doesn’t matter since, when we move the average along when we get the next price, this made up EMA is no longer used. Also, since it is a weighted average, the first instance has the least impact.

Calculating the three day EMA in Excel, using the SMA as the first “EMA value”, looks like this.



Note how the first calculation in cell D7 is different since it uses the SMA. The smoothing factor is calculated in cell D2.

That is about as much as I want to dive into the calculations. If you really want to explore the mathematics of moving averages, then Wikipedia has all you need. Links at the end of the article.

How to Use Moving Averages in Trading

Moving averages are used to define trends, both long term and short term trends. Since the EMA is more responsive to changes in price, it is generally more used by short term traders, while the SMA, which is smoother is used by longer term traders and investors. But that is a generalisation, either can be used for both long and short term. I use only EMA since I only trade in the short term.

Strategies using moving averages mostly involves “crossovers” of some kind. That could either be when a faster moving average crosses a slower moving average. Or when price crosses a moving average.

A fast moving average is one with fewer days in the calculation. A moving average using 10 days is more responsive to changes in price, or “faster”, than a 50 day moving average.

Example of a Crossover Strategy in FedEx

Entry: EMA10 crosses up above EMA20.
Exit: EMA10 crosses down below EMA20.

Here the yellow EMA10 crosses line cross above the blue EMA20 line and the trade is opened. When it crosses down below the EMA20 again, the position is closed. This was a profitable trade but not a great one. There is plenty of lost profits since it took a while for the EMA10 to cross down below again. If we had used SMA10 and 20 it would have taken even longer for them to cross, and the profit would have been even smaller.



Towards the end of the chart there is another crossover when the price gaps up on positive news. You would think that it would have been a wonderful trade, but it would not. It is a little difficult to see, but what makes the EMA10 cross above is the strong move up. So it would not have been possible to enter the trade at the $255 level.

There are other strategies however that would have entered the trade at $255-ish. But that is for another article. Trading based only on SMA or EMA crossover is not something that works in the long run. There are too many “false” signals when the market isn’t in a clear up or downtrend.

Which Moving Average is Best?

Okey, we have to ways of smoothing the price data, but which is better? Which one should you use? The short answer is that it doesn’t matter since they differ very little. Take a look at this chart of Dell with both the SMA10 and the EMA10 plotted.



The EMA10 is the yellow line and the SMA10 the purple. When the market gaps down, the EMA10 reacts much faster since it gives the most emphasis to the last day of the 10-day calculation. The equally weighted SMA10 is much smoother.

At the beginning of the chart, when the market is in a clear uptrend, there is little or no difference between the two. Is the faster EMA better since it is more responsive? Not necessarily, it is all up to you hand how you trade the markets that matter. The advantage with the slower SMA is that it cuts out a little more market noise than the EMA.

Final Thoughts

I use the EMA since I think it makes sense to give less weight to older values. The further back in time we go the less importance those value should have on smoothing the data and find trends. I also like the fact that it reacts quickly to price changes, that just suits my style of trading. The downside is that it doesn’t cut out as much noise as the SMA.

But in all honesty, I don’t think it matter which one you use as long as you pick one of them and stick to it. Even for short term trading the SMA would work just as fine. And the EMA for longer term trading as well.

A trading strategy based only on moving average will not work in the long run. It will do fine when the market goes from a period of sideways movement into a trend, but when the market is in that sideways trading range, there will be too many false signals as the averages will cross each other several times.

Moving averages can be very useful together with other indicators, price and volume. It is also common to scan for these crossovers on the various trading platforms to alert of possible trades. When you have your list of crossovers, you do in and check them one by one.

Finally, a word of warning. There are an endless number of finance influencers on YouTube trying to “sell” moving average crossover strategies with claims like; “99% accuracy” or “the secret strategy they don’t want you to know about”. These people are all scammers.

DON’T EVER apply a strategy you have seen you YouTube or read about here on Medium, and that includes any strategies of my own, if I ever decide to reveal one. You must always understand the logic behind a strategy and test it thoroughly before implementing it in the market with your own hard earned money.

Links


No comments:

Post a Comment

Volume Speaks: Unlocking the Secrets of On Balance Volume (OBV)

If you have read any of my articles on indicators, you know by now that I point out over and over again that you should not take any trading...