Exponential Moving Average (EMA)

The Exponential Moving Average (EMA) is a very popular method for smoothing data in an attempt to eliminate noise and our tests show that it is also highly effective.  Unlike the Simple Moving Average (SMA) that applies equal weight to all data, the EMA applies more weight to the recent data so that it reacts faster to sudden changes.

You can see see why it is called an Exponential Moving Average when you look at how the weighting is applied; it is in the shape of an exponential curve.  Because of this the weighting never reaches zero and the influence of early data always remains (although it has little effect outside of the specified smoothing period).  This is more clearly illustrated by the chart below which shows the weighting for a 50 period EMA and a SMA:

.

Weighting - Exponential Moving Average and a SMA.

Although we call it a 50 period EMA, those 50 periods only actually account for 86% of the weighting.  A further 12% is applied over the preceding 50 periods leaving the last 2% to be spread amongst all the prior data.  Here is a great article from MarketSci on this topic: Visual Depiction of SMA vs EMA Weighting

.

How To Calculate an Exponential Moving Average

.

Calculating an Exponential Moving Average actually requires less processing power than a Simple Moving Average because it only refers to the current period and the previous EMA value.  While it does not become active until the Nth period the EMA starts with the first close price and after that is calculated according to the following formula:

EMA = EMA(1) + α * (Close – EMA(1))

Where:

α = 2 / (N + 1)

N = The smoothing period.

Here is an example of a 3 period Exponential Moving Average:

.

How to Calculate an Exponential Moving Average

If you have two data sets and you wish to find out the EMA smoothing period, the following formula will reveal it:

N = (2-( (MA-MA[1]) / (Close-MA[1]) ) ) / ( (MA-MA[1]) / (Close-MA[1]) )

.

Exponential Moving Average Excel File

.

The EMA is so simple to calculate that it is unlikely that you would need a version in Excel but we have put together one for those of you that are lazy :).  It is free and contains the ‘basic’ version you can see above and one that will automatically adjust to the length you specify.  Find it at the following link near the bottom of the page under Downloads – Technical Indicators: Exponential Moving Average (EMA).

.

Exponential Moving Average and a Simple Moving Average

.

Exponential Moving Average vs Simple MA.

Test Results

.

If you haven’t already then check out the EMA test results.  We tested it against the SMA and D-EMA through 300 years of data across 16 global markets to reveal which is the best and the characteristics they exhibit as their smoothing period is changed.  See the results; Moving Averages – Simple vs Exponential

.

Moving Averages – Simple vs. Exponential

In this round of testing we put the Simple (SMA), Exponential (EMA) and Double Exponential (D-EMA) Moving Averages through their paces to identify which is the best and what characteristics can be expected as the length of each average is adjusted.

We tested Long and Short trades using Daily and Weekly data, taking End Of Day (EOD) and End Of Week (EOW) signals with Moving Average lengths varying from from 5 – 300 days or 60 weeks.~ These tests were carried out over a total of 300 years of data across 16 different global indexes (details here).

.

Simple vs. Exponential – Test Results:

.

.

Simple vs. Exponential Conclusion

.

Download A FREE Spreadsheet With All 948 Long and Short Test Results

.

Moving Average - Long and Short Annualized Return

Above you can see how the annualized return changes with the length of each Daily, EOD Moving Average for the Long and the Short side of the market.  The relative performance of each MA is similar when going Long and Short but the returns on the Short side were much lower.

Both the SMA and EMAs spiked in return at 25 days and then returns steadily declined as the length of the averages increased, although the SMA did see some improved performance between 190 and 250 days.  The D-EMA on the other hand is much faster and returns steadily improved as the Moving Average length increased from 20 through to 300 Days.  (See Tests on the Triple Exponential Moving Average and D-EMA over longer periods – HERE.)

I was surprised to see that every single Daily, EOD Moving Average on the Long side outperformed the buy and hold annualized return of 6.32%^ during the test period (before allowing for transaction costs and slippage).  On the Short side however, not a single average was able to beat the market during the test period.  5 – 75 Days appears to be the most effective zone, with the EMA proving to be superior to the SMA and D-EMA by annualized return.

Return to Top

.

Moving Average - Long and Short Annualized Return During Exposure

Above you can see the performance of each average during only the times that it actually had an open position.  For the SMA and EMA the annualized return during exposure decreases as the length of the moving average is increased while the D-EMA exhibits the opposite behavior right up to the longest period we tested of 300 days.  The 5 – 75 Day zone and the EMA also produce the best results by annualized return during exposure.

Return to Top

.

Moving Average - Trade Duration Long and Short

As would be expected, with an increase in the length of a moving average comes an increase in the duration of the trades that are generated.  For all three classes of Moving Average tested, the duration of trades on the Short side was far less than those on the Long side.   This is likely to be a function of two things – 1.  The fact that the global markets gained an average of 6.32%^ annually during the test period, 2.  Bull markets tend to be personified by slow and steady gains and bear markets tend to be faster and more violent.

From the above chart you also get an idea of just how much faster a D-EMA is.  Notice how on the Long side, the average duration for a 300 Day, EOD D-EMA is similar to that of a 110 Day, EOD EMA or a 85 Day, EOD SMA.

Return to Top

.

Moving Average - Long and Short Time In The Market

Exposure to the market increases on the Long side and decreases on the Short side as the length of a moving average is increased.  However the amount of exposure provided by the D-EMA levels off with each average above 140 Days long.

Return to Top

.

Moving Average - Long and Short Biggest Loss

There is no clear correlation between size of the largest single losing trade and the length of a moving average.  However the D-EMA consistently suffers larger loses than the SMA and EMA on the Long side but after 90 Days tends to suffer smaller loses on the Short side.

Return to Top

.

Across the board, the probability of profit decreases as the length of an average increases but the D-EMA clearly identifies profitable trades more consistently than the SMA or EMA on both the Long and the Short side of the market.

Return to Top

.

Daily vs Weekly Data – EOD vs EOW Signals

.

Due to the superior performance of the EMA in the previous tests, lets take a closer look at how it behaves with Daily and Weekly data, taking EOD and EOW signals to see which combination is the most effective:

Exponential MA - Annualized Return Long

As you can see, there is a big difference between using EOD and EOW signals on the shorter averages but the results from Daily and Weekly data are very similar (Note – Each Daily average is compared to its Weekly equivalent eg. A 10 Day Average is compared to a 2 Week Average).  Once the length of each average rises above 45 days the results for each data and signal combination become quite similar and above 100 days in length there is no tangible difference in return.  The results are also similar on the Short side – EMA Annualized Return Short

.

Exponential MA - Probability of Profit and Trade Duration Long

By using EOW signals instead of EOD signals little is lost in the way of return but a large amount of noise is eliminated from the data.  As a result, using EOW signals there is a jump in the probability of profit for each trade of almost 50% and the average trade duration is doubled!  This clearly shows that taking EOW signals produces far more useful trades on averages above 45 days long.  The results are similar on the Short side – EMA Probability of Profit and Trade Duration Short.  The only real drawback of using EOW signals comes with a small jump in the size of the biggest loses incurred.

Return to Top

.

Simple vs Exponential – Conclusion

.

As a general rule we can conclude that the Exponential Moving Average is superior to both the Simple Moving Average and the Double Exponential Moving Average.  It should be noted however that the D-EMA has some beneficial characteristics such as a higher probability of profit and greater returns during market exposure on the long side of the market.

It can also be said that there is very little difference between using Daily or Weekly data but using End Of Day signals will produce better results on shorter averages while End Of Week signals are just as effective on longer averages with the added benefit of a 50% jump in the probability of profit and double the trade duration.

Return to Top

.

Best Moving Average – Long

.

Rather than simply selecting the average with the greatest returns, in search of the very best we looked for:

  • Annualized Return > 9%
  • Average Trade Duration > 29 Days
  • Annualized Return During Exposure > 15%
  • Annualized Return on Nikkei 225 > 3%
  • Annualized Return on NASDAQ > 12.5%

.
Download A FREE Spreadsheet With All 948 Long and Short Test Results
.

9/474 Averages made the final cut (see spreadsheet) and any of them would make an effective trading tool but we selected the 75 Day Exponential Moving Average with End of Week Signals as the ultimate winner because it also produced good returns on the short side of the market:
.

Exponential MA - 75 Day, EOW Long
The 75 Day EMA, EOW Long has you exposed to the market 62% of the time and produces an average trade of 74 days in duration with a comparatively high 41% probability of profit.  It also performed well on both the NASDAQ and ‘bear ravaged’ Nikkei 225. On the Short side it performed respectably as well; managing to endure the bullish periods by suffering only limited loses and making good returns when the market fell.

It will always be difficult for an indicator as basic as a Moving Average to successfully identify trades on the Short side during a period where the average market advanced 6.32%^ annually.  However combined, the attributes of this particular Moving Average make it well suited for use in conjunction with other indicators as part of a complete trading system.

.

See how the 75 Day EMA EOW Performed on Each MarketSee the results for the 75 Day EMA, EOW
Long and Short on each of the 16 markets tested.

Return to Top

.

Best Moving Average – Short

.

The Short side of the market is very different to the long; cycles are faster and more volatile so the moving average most suited to a bear market is not necessarily the same as that most suited to a bull market.  Of the 474 averages we tested on the Short side, in search of the very best we looked for:

  • Annualized Return > 0.5%
  • Average Trade Duration > 10 Days
  • Annualized Return During Exposure > 1.8%
  • Annualized Return on Nikkei 225 > 1.5%
  • Annualized Return on NASDAQ > 0.5%
  • Probability of Profit > 25%

6/474 Averages made the final cut (see spreadsheet) and any of them would make an effective trading tool but we selected the 25 Day Exponential Moving Average with End of Day Signals as the ultimate winner for Short trades because it produced the best returns out of the finalists:

.

25 Day EMA EOD - Short

The 25 Day EMA, EOD Short has you exposed to the market 40% of the time and produces an average trade of 12 days in duration with a comparatively high 25% probability of profit.  By going with a much faster average on the Short side of the market, bearish profits are improved but this comes at the expense of more active trading.  In the real market the more frequently you trade the greater your transaction costs, slippage and time required to execute the signals.

It is worth noting that this average performed O.K on the Nikkei 225 but didn’t produce outstanding results despite the Nikkei suffering a prolonged bear market during the test period.  Surprisingly, the much longer 75 Day EMA, EOW Short (and several other averages above 45 days long) performed better than the 25 Day EMA, EOD Short on the Nikkei 225.  This would suggest that a faster average has a better chance of making money on the Short side during a bull market but a slower average will produce better returns through a prolonged bear market.  (Stats for bullish trades – 25 Day EMA, EOD Long)

.

 

See how the 25 Day EMA EOD Performed on Each MarketSee the results for the 25 Day EMA, EOD
Long and Short on each of the 16 markets tested.

.

More in this series:

We have conducted and continue to conduct extensive tests on a variety of technical indicators.  See how they perform and which reveal themselves as the best in the Technical Indicator Fight for Supremacy.

 

 

Return to Top

 

  • ~ An entry signal to go long (or exit signal to cover a short) for each average tested was generated with a close above that average and an exit signal (or entry signal to go short) was generated on each close below that moving average.  No interest was earned while in cash and no allowance has been made for transaction costs or slippage.   Trades were tested using End Of Day (EOD) and End Of Week (EOW) signals for both Daily and Weekly data. Eg. Daily data with an EOW signal would require the Week to finish above a Daily Moving Average to open a long or close a short while Weekly data with EOD signals would require the Daily price to close above a Weekly Moving Average to open a long or close a short and vice versa.
  • ^ This was the average annualized return of the 16 markets during the testing period.  The data used for these tests is included in the results spreadsheet and more details about our methodology can be found here.
  • * The ‘best averages’ highlighted on this table were selected by picking the top performers after averaging the returns of all four tests on each Moving Average length; Daily EOD, Daily EOW, Weekly EOD and Weekly EOW. Eg. The results for a 100 Day and the equivalent 20 Week Moving Average using both EOD and EOW signals have been averaged.
50 Day EMA, EOW Short