SMA vs EMA

During last year, I realized that I have some psychological issues while trading (and now I know we all have them), so I’ve decided to solve this problem by building my own trading robots and slowly improving my trading psychology until I am capable to handle stress (and all other emotions) while trading. Although I had some smaller success with trading robots, I finally realized that I will have much bigger psychological problems if I allow some “stupid” piece of software to make trading decisions instead of me. On the other hand, I am aware that, even if I lose money, it’s not something I can’t afford to lose. Also, if I lose (or win) money I have to learn how to take full responsibility for that.

Anyway, learning how to build my own trading robots was a good experience and it taught me to look at trading from some kind of statistical point of view.

Since I am already a developer, I have decided to learn MQL programming, build my own Forex trading robots and use them to test some indicators/strategies to see if any of them have an edge. I am more of a discretionary trader than the systematic one, but I use some indicators in my trading. I also think that, if I am using some tools in my trading, I should be aware how these tools work and if they work at all.

Moving Average

A moving average (MA) is probably the most popular indicator for technical analysis. It simply shows the average price of particular security over a defined number of time periods. The simple moving average (SMA) shows the average price, while the exponential moving average (EMA) gives more weight to recent prices.

Here is a moving average crossover EA I developed. I will maybe go into more details on how to develop it in one of the future posts. But for now, you can simply copy the following code to your MetaEditor, compile it and start using it:

SMA vs EMA

RELATED POST  The psychology of my trading and what I'm going to do about it

First, I would like to find out which of them is more profitable. I will use fixed lot size (0.02 lots) and different stop-loss/take-profit levels (50-200 pips). I will compare SMA vs EMA on EURUSD currency pair and multiple timeframes. I will run the optimization for year 2016 until 2017, and for 2007 until 2018 to see how each of them performs during a very long period and during the global crisis (2008). Starting balance is 1000USD. I will search for set-ups with largest profit factor. So, here are the results:

2016 and 2017 on M15 timeframe:

SMA:

EMA:

2016 and 2017 on H1 timeframe:

SMA:

EMA:

2016 and 2017 on H4 timeframe:

SMA:

EMA:

So it seems that from the beginning of 2016 until the end of 2017, the SMA performed better on H4 timeframe and the EMA performed better on lower timeframes (M15 and 1H), with higher Profit Factor average.

Final Result: SMA 1:2 EMA

2007 until 2018 on M15 timeframe:

SMA:

EMA:

2007 until 2018 on H1 timeframe:

SMA:

EMA:

2007 until 2018 on H4 timeframe:

SMA:

EMA:

It seems that EMA was again more profitable than the SMA. Of course this would require more testing on other timeframes and with other currencies to get a more accurate result, but what I already know is that EMA also has less lag,

Final Result: SMA 1:2 EMA

Total Result: SMA 2:4 EMA

You can use my code and try your own combinations of setup parameters. Put your results in the comments section below, so we can discuss them together.

RELATED POST  MarketLife Trading Review

Subscribe for FREE and get the following:

  • Free Excel Templates and printable PDFs for your Money Saving Challenges
  • Free MT4 indicator which I used to earn 18% of my trading account in only 3 months
  • Useful trading, investing and money saving tips
  • Weekly list of websites & articles which will expand your knowledge and teach you how to spend less and earn more
  • Updates on new posts on my blog
Invalid email address
We promise not to spam you. You can unsubscribe at any time.

Leave a Reply

Your email address will not be published. Required fields are marked *