Backtesting in the MT4 strategy tester

If you are familiar with the MetaTrader 4 platform, you would have come across expert advisors or EA’s for short. If you are new to the MT4 platform, this is the fancy term for forex robots that run in the platform. One of my favourite features of MT4 is the strategy tester where we can backtest expert advisors across historical data of any currency pair and timeframe. Backtesting in MT4 can give us a rough idea of how a forex robot may have performed historically speaking but there are some limitations which I will cover in this detailed MT4 backtesting guide.

What is MetaTrader 4 (MT4)?

Most of you will already have the MT4 platform installed on your computer or mobile device and use it for your forex trading. It is perhaps the most popular forex trading platform that is used by millions of forex traders all over the globe. Not only can you manually trade forex on MT4, you can trade CFDs on stocks, commodities, indices and cryptos.

I think MT4 is the best platform for running automated forex trading systems in the form of MT4 expert advisors. Just keep in mind that you will need the desktop version of the platform to run and backtest forex robots on MT4 as the mobile platform is not capable of doing so.

What are MT4 expert advisors?

To clarify on what I touched upon earlier, MT4 forex robots are automated trading systems that have built-in trading algorithms which can automatically scan charts in the MT4 platform for trading signals. When the underlying trading logic implemented within the expert advisor code finds a valid trade setup, it can place and manage trades on behalf of the user.

The convenience and simplicity of automated trading in MT4 makes it a very popular platform for aspiring forex traders who want to take advantage of automated forex strategies. You will find there are literally hundreds and thousands of forex expert advisor you can choose from, both free and paid. You can get MT4 forex robots from directly within in the platform and from independent developers. Please feel free to browse through my best forex robots if you need some inspiration.

What is the MT4 strategy tester?

So, now we know what the MT4 platform is and forex expert advisors, lets take a look at the MT4 strategy tester. This is a handy interface within the MT4 platform where you can load and test your forex robots on any financial instrument and timeframe available in the platform. This is used to get a rough idea of how a forex robot might have performed over a particular data set.

How to backtest in the MT4 strategy tester using expert advisors?

You can see the MT4 strategy tester in the image below. This is where you choose the forex robot (expert advisor) that you would like to backtest and data that you would like to use. I have highlighted where you choose the expert advisor, date range and chart timeframe.

MT4 Strategy Tester
MT4 Strategy Tester

Whilst it may be tempting to hit start, you will first need to download the relevant data from your broker. You can get this from the MT4 top menu – tools – history center. Select the relevant symbol and timeframe from the list on the left then hit download to get your data. Once the download is complete, you can then start your backtest in MT4.

MT4 Backtesting Data
MT4 Backtesting Data

Now that you have the historical data for the currency pair that you wish to backtest in MT4, it is time to choose your EA settings. Simply hit the “expert properties” button in the MT4 strategy tester window and you will be able to see a list of all the external EA inputs there. You can amend the EA settings accordingly.

MT4 Expert Properties
MT4 Expert Properties

If you choose variations of settings using the start, step and stop fields, you can combine settings and run an optimization of the EA using the “optimization” check box in the MT4 strategy tester. What this does is combine all of the setting variations that you have chosen to provide you with the MT4 backtesting results of all combinations

Optimization in MT4 strategy tester
Optimization in MT4 strategy tester

After your MT4 backtest has been complete, you will be able to see the statistics of how the forex robot performed along with an equity curve that hopefully goes upwards! The most important stats that I like to look out for are the profit/loss, drawdown, profit factor, win rate, average profit/loss and trade volume.

MT4 Backtesting Results
MT4 Backtesting Results

Now you have a basic idea of how to backtest in MT4, you are free to experiment with any forex expert advisor that you wish. Simply follow the process from downloading the data, to choosing your settings and running a backtest. After that, you can view the statistics to see the results of your backtest.

MT4 Strategy Tester Report
MT4 Strategy Tester Report

The MT4 strategy tester also has a check box you will see called “visual mode”. If you check this, then you can watch the EA you are backtesting trading on the charts over historical data. This can help you to analyse each entry/exit and discover ways in which the EA could be improved.

MT4 Backtesting Visually
MT4 Backtesting Visually

How to backtest manually in MT4?

Did you know that backtesting in MT4 was not just limited to forex robots? Nope, you can also backtest manually trading strategies in a few ways. The most obvious way is to simply scroll back through the charts and mark off your entry and exit points according to your trading strategy. Don’t be too generous with yourself though and cherry pick your trades.

Make sure you stick to the trading strategy and plan you are backtesting. It is easy to say “I would not have taken that trade” when you know that you really would have. Instead, look for ways in which you could have improved the entry and/or exit. You might want to add a few technical indicators or check for price action to filter false signals and better time your trades.

You could also use a trading simulator software. This will automatically run visual charts with features that allow you to place trades as if it was in real time. You can speed up time to see how your trades played out or slow it down to practice timing your entry. This is a great way to practice your trading strategies and master your forex trading skills without taking any risk.

MT4 backtesting Pros & Cons

To be honest, even with the most perfect MT4 backtesting conditions, we are only using historical data and the forex market is constantly changing. We could develop a forex robot tomorrow that has a 100% win-rate over the last 20 years of historical data, but it may crash and burn in a few days of live testing. That is why I only use the MT4 strategy tester as a rough guide and to test out ideas or check robot settings and results.

Go careful, because some forex developers will deliberately take advantage of the lack of MT4 backtest quality and make poor forex robots look amazing on historical data. They could do this by manipulating the data, having unrealistic spreads, not accounting for commissions or simply over optimising the EA to curve fit the data set that they are using. If you are on the look out for a forex robot, always check for those which have published verified live account results that have been running for a significant period of time, such as the Forex Robotron EA.

If you just want to experiment with various forex robots and try out some different settings on various currency pairs and timeframes, then the MT4 strategy tester can help with that. If you do come across some interesting EA settings and want to see of the backtest results can be replicated moving forward, you could always start on a forex demo account to begin with and see how things go. You can get a free demo account from most forex brokers including IC Markets who are my top choice for running automated trading systems. They have tight spreads, low commission fees and deep liquidity pools to ensure rapid trade execution speeds with minimal delays.

Pros

  • Get an idea of historical performance
  • Test different MT4 forex robots
  • Test on any currency pair and timeframe
  • Relatively easy to use
  • Optimize settings to find best combinations
  • Stress test EA’s through various market conditions
  • Visually backtest your forex strategies

Cons

  • Results are not always that accurate
  • Takes some time learning how to use it
  • 90% modelling quality limit without other software
  • Does not use real spreads, tick data, slippage or commission
  • Can give false sense of hope on performance
  • Can be used by developers to make false claims

Conclusion: do I need to backtest forex robots in MT4?

Yes, in my opinion if you are using any forex robot you should backtest it in the MetaTrader 4 strategy tester before using it. Backtesting in trading is a method of evaluating a certain strategy by applying it to the historical market data. It basically indicates whether the given strategy may have been successful in the past, which then gives traders and analysts confidence to actually incorporate that strategy in their future trades.

However, the MT4 strategy tester results are usually quite inaccurate by themselves which is why you should try to backtest using a third-party software such as Birts Tick Data Suite (TDS) which adds tick data, real spreads, slippage and commission to orders. This can be the difference between good and bad MT4 backtest results. I have seen forex robots that look amazing in MT4 backtests but completely burn when forward testing because the MT4 backtesting conditions were limited to 90% modelling quality. Birts TDS can achieve 99% modelling quality which is not perfect, but is the best that the MT4 strategy tester can do.

Hopefully this MT4 backtesting guide has helped you understand a little more about how backtesting in the MT4 strategy tester works. To be honest, I think the best way to familiarise yourself with backtesting in MT4 is to try it for yourself and play around with the different options. It might take a while, but once you know how to use it correctly, the MT4 strategy is an excellent tool. Feel free to use my free forex robot if you need an expert advisor to experiment with. It includes most of the MT4 indicators and candlestick patterns, along with money management features.