The Ultimate Guide to MT4 Backtesting
How to Perform Accurate Backtests in MT4 to Reach 99% Modelling Quality Using Free Tick Data and Real Variable Spread
MetaTrader 4 can reach 90% modelling quality at its best by default and it cannot incorporate real variable spread. But there's a better way to run backtests and you will learn it in this tutorial.
Written by www.Autotrading.Academy
Why should you perform a highly accurate 99% quality backtest on every automated trading strategy (EA)
A standard backtesting on MetaTrader 4 terminal using the data from the MT4 history center is usually good enough for Expert Advisors (EA) that are not scalping or pip hunting.
However, if you’re dealing with a scalping EA or any EA that closes trades within 1-15 pips, even the smallest price feed differences might have a very large impact on the results.
The problem here is that the MetaTrader terminal does not have access to the real tick data. It only has access to minute bar data in the best case. Because of this, MT4 generate “false” price ticks through a process of interpolation using the data for the smallest timeframe available.
This is usually not so important to an Expert Advisor that uses stop loss and take profit targets of more than 100 pips, but in the case of scalping trading bots, your backtest will likely be completely misleading.
It is very important to backtest trading strategies (EA) using data of quality that is as high as possible. Every trader and programmer should learn how to backtest on MetaTrader 4.
Top 3 reasons to use Every Tick 99% modelling tests
Rescue You From Losing Money
Tick data backtest of 99% accuracy usually reveals failing strategies that promise good results in a lower quality backtest report. In other words, a more accurate backtest shows what you can expect from the EA, because it is closer to the real trading environment. Expert Advisors which do not show good 99% backtest results are not worth the time and the money.
99% backtest using high-quality tick data and a real variable historical spread is the most accurate test you can do on MetaTrader 4. Basically, such trading simulation shows a more accurate picture of the past performance and especially if the EA is sensitive to different price quotes and trading costs like spread and slippage.
Reveals the Dark Side of the EA Strategy
It’s fairly easy to create an EA which shows a good performance report in a low quality backtesting environment. However, the 99% accuracy backtest using high-quality tick data would reveal the real truth. It is much easier to judge past performance looking at the most accurate test report.
99% modelling quality backtest basically shows the ugly truth and reveals weak side of the strategy (MT4 EA)
Below you see two backtest results of the same Expert Advisor. First backtest is of 90% accuracy and the next one is of 99% accuracy.
It's obvious that this EA is not worth wasting anyone's time and money, because it's clearly visible it fails to perform when spread is variable and charging every tick (which is what happens all the time in the markets).
EURUSD history center data, default settings, 2010-2015
EURUSD Dukascopy data, default settings, 2010-2015
Tools you'll need to perform a 99% modelling quality Tick Data backtest with a variable historical spread
MetaTrader client terminal
It's obviously you'll need to have MT4 platform installed on your computer in order to run any kind of backtest using MT4 Strategy Tester. However, note that MT4 alone can reach 90% modelling quality at its best and it even won't have real spread incorporated. MT4 alone can only use fixed spread which gives inaccurate results.
MetaTrader 4 trading platform is free of charge and available at mostly any Forex broker.
Tick Data Suite 2
Tick Data Suite is the only paid software you'll need to reach 99% modelling quality. The software is quite easy to install and easy to use. TDS not only offers 99% modelling quality backtests, but also adds real historical variable spread that have actually happened in the past. It also allows simulation of slippage and running multiple MT4 instances at the same time from the same installation so you can run multiple backtests simultaneously.
TDS is the only software available for 99% modelling quality backtests with real variable spreads incorporated.
Tick Data Suite is not free, but it's price is quite reasonable.
Why choose Tick Data Suite 2
All Tools in One Place
With Tick Data Suite 2 you have all backtesting tools in one place. You won’t need any other software to download, convert and export tick data.
Saves Disk Space
Tick data downloaded by Tick Data Manager is compressed using special algorithm so it takes less disk space.
Very Easy to Use
Tick Data Suite 2 integrates directly into each and every MT4 terminal on your computer. Install once and simply access TDS2 from MT4 Strategy Tester.
Multiple MT4 Terminals
TDS2 allows you to run multiple MT4 terminals simultaneously from the same installation folder. This means you can run multiple EA backtests and even EA optimizations at the same time.
Switch Time Zones
Easily switch between time zones and DST settings without the need to re-download and re-convert the data. It is easy as selecting other time zone settings from the list.
You can create custom backtest environments to match the settings of any broker or any trading account. You can test how EA behaves with different leverage, minimum price distances, swaps, commissions, etc.
Use Variable Spread
TDS2 is the only software which allows to use variable Spread during the backtest and even customize it. This shows you how EA works in the trading environment close to real market conditions.
TDS2 has an option to simulate the slippage during the backtest. Slippage can be applies on entry, exit, SL and TP. This shows how your EA backtest results look like when price slips, which happens quite often in real life.
Let's setup your MT4 backtesting environment
Before you can run any backtest you'll need to prepare your backtesting environment which is to download, install and configure required software.
Install Tick Data Suite for MT4
Download and install Tick Data Suite 2 software. This software is mandatory for running Every Tick 99% modelling quality backtests with real variable spread incorporated.
Download Tick Data Suite 2
Download Tick Data Suite 2 from this website:
TDS 2 is a paid software. There's a free trial available if you want to test it before you buy.
Tick Data Suite 2 is the only software available for 99% modelling quality backtests with real variable spreads incorporated. Any other computer applications for backtesting on MT4 does not have an option to use real historical spread.
Run Tick Data Suite 2 setup
Once downloaded, start Tick Data Suite 2 auto-installer and follow on-screen instructions.
Choose to install additional programs (if required)
Additional programs are required to run Tick Data Suite 2 application. In the "Prerequisites" step you will be asked to install them and you should do that, otherwise, TDS2 will not work.
Additional required programs: "Visual C++ Redistributable for Visual Studio",".NET Framework 4.0"
If these programs already exist on your computer, you will not see this step.
Enter your TDS2 License Key
Once the additional programs are installed and you continue with the TDS2 setup, you will be asked to enter your License Key.
Enter your License Key, click NEXT and finish the installation following on-screen instructions.
Tick Data Suite 2 installation completed
Tick Data Suite 2 installation will create a shortcut to the Tick Data Manager on computer's desktop.
Download Tick Data for MT4 Backtesting
Using the Tick Data Manager application, which comes with the Tick Data Suite 2, you need to download tick data from Dukascopy or other available source. This is the historical price data you can use for backtesting.
Download Tick Data for EURUSD
Tick Data Manager allows you to download history price tick data of any currency pair or instrument available at Dukascopy or TrueFX.
In this example I am going to download all available EURUSD Tick Data, which is from year 2013.
As you can see there's an option to choose how much tick data you want to download by clicking buttons: Last Year, Last 6 Months, New Data, All Data or Year To Date.
Once you are ready click the "Start download".
Tick Data Manager has a "Task queue" window and this is where you will see all the download tasks appear when you start them. You can have many download tasks scheduled in the Task queue.
This allows you to download tick data for many pairs by leaving your computer on when leaving for work, etc.
You can also pause, cancel, delete tasks if necessary.
In the image above you can see there are three currency pairs (EURUSD, GBPUSD, USDCAD) that have tick data downloaded. This is easy to see when you look at the "Downloaded days" column which shows how many days of history price data is actually downloaded for each instrument.
Other columns show more information.
For example "Start date" shows from which date history price data is available for each instrument at selected source (Dukascopy in this case).
"Oldest downloaded" and "Most recent downloaded" shows you the date range of tick data you have actually downloaded on your computer.
I am writing this guide on 17th October 2016 and in this example I have all tick data for EURUSD from May 4th 2003 until October 16th 2016 (yesterday).
I have all GBPUSD tick data for 2016 and last 6 months of tick data for USDCAD.
Download & Install MetaTrader 4 platform
Download MetaTrader 4 for PC, install it and create a demo account. If you already have an MT4 client terminal installed you can jump to the next step.
Download & Install MetaTrader 4
Download MT4 from your broker's website or directly from here:
Once downloaded, start the MT4 installation setup file, which is usually named mt4setup.exe
If you download MT4 from your broker, the file name might be different, but the installation process is usually the same.
Follow MT4 setup on-screen instructions
Once you agree with the terms and conditions you can click NEXT to proceed to the next step and complete the installation.
If you want to install your MT4 client terminal to some specific folder then you need to click the SETTINGS button and choose custom installation destination folder (this is not required).
Start MT4 client terminal
After you install MT4 terminal you will find a new shortcut created on your desktop. Start it now.
Create a new demo MT4 account
Once MT4 loaded, you need to create a demo account.
First, you need to select a demo server of your broker or simply add "MetaQuotes-Demo" server to the list by clicking the "add new broker ..." and typing "MetaQuotes". Once the server appears on the list, select it and click NEXT.
Then, select "New demo account" and click NEXT again. Follow on-screen instructions to finish opening a new demo account.
If you have an account already just click CANCEL and log into your account.
Log into your MT4 account
After login window appears enter your MT4 account number (login) and password to log into your MetaTrader 4 account.
MT4 accounts has two passwords (main and investor) and they both will work for running backtests.
Running 99% modelling quality Every Tick backtest with real spread
Now you are ready to run "Every Tick" MT4 backtests with real spread incorporated and reach 99% modelling quality. Having real historical spread in your backtesting process makes your strategy test more precise.
Open MT4 Strategy Tester
Backtesting of automated trading strategies (Expert Advisors) is done in the MT4 Strategy Tester window. You can open it from the top menu (View -> Strategy Tester) or by pressing CTRL+R.
Check if Tick Data Suite 2 is loaded
Before you run backtest Forex trading strategies (EA) you should check if Tick Data Suite 2 is loaded with your MT4 platform.
If TDS2 is loaded you will see a button "Tick data settings" and a checkbox "Use tick data" in the MT4 Strategy Tester. You might need to resize your MT4 window to make it wide enough for those options to appear.
Also, if TDS2 is loaded, then you should see additional menu options in the About menu section of the MT4 terminal.
Enable variable Spread and set other TDS2 settings
To configure Tick Data Suite 2 and choose how you want backtest to be performed you need to open TDS2 settings window by clicking the "Tick data settings" button.
In this example I enable variable Spread and click OK. You can see "Variable" is set the Spread value in the MT4 Strategy Tester.
Select Expert Advisor (EA) you want to backtest
Choose which Expert Advisor you want to test and click "Expert Properties" to set your desired parameters.
In the "Testing" tab enter initial deposit amount, choose currency and make sure "Long & Short" positions are selected to allow both, BUY and SELL operations.
Set your desired Expert Advisor (EA) inputs
Most of the Expert Advisors have at least few parameters you can set. In the "Inputs" tab you can set them the way you want for this particular test.
You will find all variables (settings) listed in the Inputs tab. Simply enter/set desired value for any parameter in the Value column. If you want to reset to default settings click the RESET button.
Ignore columns Start, Step, Stop. You do not need them now, because they are for EA optimization and not used during a backtest.
Select instrument, time frame and modelling type
Next step is to select currency pair (Symbol) and its time frame. Then you need to select "Every Tick" as your modelling type.
It has no effect if you change the Spread here. Tick Data Suite 2 will override this setting and use real variable Spread, because I have set it that way in the previous step.
Set the date range
Strategy Tester allows you to select date range for the test. If it's not selected, like in this example, backtest will be performed on all available history price data.
But if you need to test the strategy only during specific date range you can easily do that.
When you done setting parameters click "Start" to begin the test. It might take a while depending on how long the date range is, EA algorithm and your computer power.
Check backtest report
After backtest is finished you can see the results. In this equity chart we see modelling type and quality is printed, which was "Every Tick" with 99% quality.
In the "Report" section you can see more results of the backtest including the modelling quality number as well.
Additionally you can find full trade list generated during the test in the "Results" tab. To find if there were any errors see the "Journal".
To restart the test again go to the "Settings" tab.