There are several different types of moving averages out there, but my favorite is the Exponential Moving Average (EMA).
In this beginner's guide, you'll learn what the EMA is, how it works and the results of a super simple trading strategy that uses the EMA.
The Exponential Moving Average shows the average closing price of the previous candles over a specified period of time. It gives more weight in the average to the most recent closing value, and therefore has less lag than the Simple Moving Average.
I could start by giving you the formula for how to calculate it, but that's boring and overly complex.
If you really want to know how the formula is calculated, I'll provide that towards the end of this guide.
But let's start off with something way more practical.
What is a Moving Average?
A moving average is a graph of the average closing price of a market over the last X number of candles/bars.
Let's use a setting of 10 as an example.
So on a daily chart, the current moving average value would be the average of the closing prices of the previous 10 days.
On a hourly chart, it would be the average of the closing prices of the last 10 hours.
When you're trading, you'll often see the number of candles used in the calculation in parenthesis.
It looks like this:
The Difference Between an Exponential Moving Average and a Simple Moving Average
A Simple Moving Average (SMA) takes the sum all of the closes in the range and divides that number by the number of candles in the range, which is 10, in the example above.
Here's what it would look like in a spreadsheet.
The number in the bottom right corner is the average of the closes from the last 10 days.
An EMA does something similar, but it gives more weight to the closing price of the most recent candle.
Therefore, it lags less than the SMA.
Here's how that looks on a EURUSD daily chart.
As you can see, the EMA stays closer to the current price than the SMA does.
This is why I prefer to use the EMA…most of the time.
You can also use the the open, high or low, instead of the close, to calculate the EMA.
Here's what it looks like when I put the open, high, low and close EMAs on the same chart.
Interestingly, the EMA of the open and the close are almost identical.
But the most commonly used price point is the close.
Why the EMA is Useful
The EMA smooths out the complex price movements on a chart and gives us one simple line, which we can use to develop trading strategies.
This line shows us the overall trend of the market and gives us a reference point to take trades.
When the EMA is used as a trend indicator, pullbacks into the EMA can be great places to enter trades, or add to an existing winning trade.
Here are some examples of where you could have opened buy trades on the NEM chart.
This chart uses the 50 EMA (blue) and the 20 EMA (green).
Notice how using EMAs with different settings can help us take advantage of different phases of the trend.
When the trend is weaker, the 50 EMA gives is 3 buy points, as shown by the blue arrows.
As the trend accelerates, the 20 EMA becomes more useful and gives us one entry at the green arrow.
EMAs can also be used in conjunction with other indicators to create countertrend, or against-the-trend, trading strategies.
Here's an example of a 100 EMA on a gold chart, paired with the RSI indicator.
Notice that when RSI goes overbought or oversold, price tends to move back towards the EMA.
This is an example of a countertrend EMA strategy.
Which EMA Setting Should You Use?
The setting you use will depend on the length of the trend you want to identify.
If you want to find longer term trends, you'll include more candles in the moving average.
Something like a 200 EMA is a common setting that traders use to identify a long term trend.
Here's a 200 EMA on the BTC daily chart.
As you can see, the 200 EMA smooths out the downtrend and allows us to see that the long-term trend is down.
For a short-term trend, you'll use a lower EMA setting. A frequently used EMA setting is 20.
This is what the 20 EMA looks like on a chart.
The 20 EMA on this RIVN chart shows that the short-term trend is up.
So if you want to capture long term trends, use a higher EMA setting.
If you want to trade shorter term trend, or you want to place trades in fast moving markets, use a lower EMA setting.
Traders use variations of the settings, depending on the type of market they are looking for and what their backtesting has shown to work.
Obviously, there are many potential settings that you can use.
But let's take a look at an actual trading strategy and the settings that are commonly used with this strategy.
I'll also show you the backtesting results from using these settings.
EMA Crossover Strategy
A well-known moving average trading strategy is to trade when a faster moving average crosses over a slower moving average.
For example, the Golden Cross and Death Cross are often mentioned in the mainstream finance media.
This method usually utilizes the SMA, but the concept is exactly the same.
Here's a chart of the S&P 500, showing the Death Cross that occurred in March.
The purple line is the 50 SMA (faster) and the gray line is the 200 SMA (slower).
So when the 50 SMA closes under the 200, you sell.
When the 50 SMA closes above the 200, you buy.
If you have an existing position, you close it out and enter a trade in the opposite direction.
Obviously, there are more details that need to be added to make this a complete trading plan.
So here's a trading plan that I created and tested in NakedMarkets, using the 50 EMA and 200 EMA, instead of the SMA.
Like I said before, I like the EMA better because it tends to be more responsive to price changes.
You can use almost any platform to backtest this strategy manually, including MT5. But NakedMarkets makes it much easier.
- Go long when the 50 EMA closes above the 200 EMA. Place the stop loss below the last swing or below the 200 EMA, if there is no obvious swing.
- Go short when the 50 EMA closes below the 200 EMA. Place the stop loss above the last swing or above the 200 EMA, if there is no obvious swing.
- 2% risk per trade.
- 1 entry per signal, 1 trade at at time.
Here's an example of a short entry, with a stop loss (red line) above the swing level before the crossover.
Set the stop loss to breakeven, once the trade is profitable by 1R.
Wait for price to hit the stop loss, or the EMAs to cross over in the opposite direction.
EURUSD Daily Chart Results
I tested this trading strategy on the EURUSD daily chart, from 2004 to 2022.
This is a really easy strategy to backtest and can be completed in just a few minutes on the daily chart.
Here are my results…
As you can see, this method didn't trade too often.
But it's really good at riding strong trends when it does take a trade, logging a 34.53% gain on the best trade.
This trading strategy is super simple and a great starting point for beginners.
The test was done with zero optimization and used the settings that are freely available on many websites and in YouTube videos.
Therefore, you can do some analysis of the strategy to see if there ways that you could improve the results.
You could experiment with different EMA settings, moving the trade to breakeven sooner, and testing this on different timeframes.
Although this strategy only averaged about 5.71% per year, imagine if you had 5 to 10 markets or timeframes that you trade this on.
That can add up to a solid yearly return.
So get to testing and find the markets, settings and timeframes that work for you.
You might want to try the 4-hour chart next. It's also very easy to test and you can see your results quickly.
USDCAD Daily Chart Results
I also tested the USDCAD on the daily chart from 2006 to 2022.
These results weren't as good as the EURUSD results, but it was still profitable.
So there is some potential here and should be explored further.
I noticed that I missed a couple of huge trends because the strategy exited at breakeven.
A re-entry rule could be added to catch these trends.
There's also the potential to split each trade up into 2 parts, taking some profit on the initial move, then leaving the rest to run.
I'm just giving you a starting point here.
Again, try different settings and timeframes on the USDCAD.
It's up to you to test, improve and master this strategy.
Why is the 200 EMA Important?
The 200 EMA is often used to determine the long-term trend of a market.
If price is below the 200 EMA, that's often seen as bearish, and if price is trading above the 200 EMA, that's bullish.
Traders who use the 200 EMA will usually only look for shorts is price is below the EMA and only look to buy if price is above the EMA.
It's often used when trading stocks, but can be applied to any market.
But remember, always test first!
The Exponential Moving Average Formula
Alright, if you've made it this far, then you must really want to know how to calculate the EMA.
So here it is…
EMA = k x C + P
k = 2 / (n + 1)
n = Number of days included in the EMA calculation, or the EMA setting
C = Current closing price – Previous EMA
P = Previous EMA
This can be a little confusing, so I'll break it down for you.
Weighting Factor Explained
The weighting factor is k. This gives more weight to the current closing price, based on the number of periods used in the settings.
So if there are more days in the EMA calculation, the current closing price will have less of an effect on the current EMA value.
If there are fewer days, the current closing price will have more of an effect.
Let's start by looking at how a 10 period EMA affects the k value, versus a 200 period EMA.
k = 2 / (10+1) = 0.18
k = 2/ (200+1) = 0.01
In the case of the 10 EMA, the current price has 18% or 0.18 more weight in the moving average than the other 9 data points.
Since there are more data points in the 200 EMA, the current closing price has a smaller effect and only has 1% or 0.01 more weight than the other 199 data points.
Putting it All Together
When the weighting factor is multiplied by the difference between the current closing price and the previous period's EMA value, you're simply giving more weight to the current EMA value.
Finally you add in the previous EMA value to get the current EMA value.
Final Thoughts on Trading with the EMA
The Exponential Moving Average is a great indicator to use to build trading strategies.
I've given you one way that you can use the EMA to trade.
But now it's up to you to test this trading strategy and make it your own.
The secret to successful trading is learning a strategy that works, then customizing it to your unique personality.
So if you would like to move forward with this EMA crossover trading strategy, the next step is to start backtesting.
I've created this backtesting guide for beginners that will help you figure out your favorite settings and which markets/timeframes this strategy works in.
Remember that just because the strategy worked in the examples above, does not mean that it will work in all markets and with all timeframes.
You HAVE to backtest.
But backtesting is a process of discovery and can be a lot of fun.
Now get to work!