How to Get Simulation Quality of 99% in the Strategy Tester in Metatrader 4

How to Get Simulation Quality of 99% in the Strategy Tester in Metatrader 4

Anyone, who has ever performed backtesting of EAs in MT4, noticed that the quality of the simulation doesn’t rise above 90%.

The reason is that by default, the terminal uses minute bars instead of tick data. And if an advisor performs scalping (with take-profit of 3-15 points), or use a small trailing stop, the difference of the simulation quality can greatly change the test result.

Example:

Backtest of the same EA with the same settings per year

1.90%

90%

2. 99%

99%

The difference of 2,000 points is obvious.

Instructions

  1. First of all, I recommend to install a separate Metatrader 4 terminal to a separate folder exclusively for testing strategies.
  1. Next, you can use the method described below or use alternative one with the help of the Tickstory Lite Program. The methods are different, but the end result is the same.
  1. Now we need to get tick data. Dukascopy is one of a few brokers, if not the only one, that provides free of charge tick history of the highest quality (by the way, it is a liquidity provider for Alpari’s ECN-accounts).

1) Open a demo account here (you can use the 10minutemail temporary email service to prevent subsequently receiving SPAM on your main box).

2) After receiving a Username and a Password on your mail, be sure to write them. Next, click the link -> JFOREX DEMO START. And a small file with the .jhlp extension will be downloaded on your computer. Run it (Java must be installed on your computer), accept all installation terms and conditions and then enter the username and the password that you have received by mail earlier.

DO NOT CHANGE THE PROGRAM LANGUAGE!! IT SHOULD REMAIN ENGLISH!!

3) Click Tools -> Historical Data Manager inside the Jforex terminal. The data manager window will appear at the bottom of the terminal box, from where we will download quotes.

Click Tools -> Historical Data Manager inside the Jforex terminal. The data manager window will appear at the bottom of the terminal box, from where we will download quotes.

Put a comma in the Delimiter field (it’s important), and select Ticks in Data Type. Select a currency pair at the bottom of the window (you can select several pairs by checking the boxes near them). Select the time period for downloading (for the first time, to save time and to make sure that you did everything right, I advise you to download a short period of a month or two for a pair).

Then press the Start button. Downloading quotations will begin, which can take quite a long time depending on the time period and the number of pairs selected. As a result, you will receive .CSV-file(s); by default, it is saved in the Documents folder (it’s accessible via the Start Menu in Windows).

4. So, we’ve got the tick data. Now, we need to convert them into a format understandable for Metatrader, patch the terminal and run backtesting.

Download and unzip the scripts by reference at the end of the article. Copy the MQL4 folder into the data directory of the terminal for testing (see. User Script Installation), agree to replace files with the same names.
Copy the file with the tick history (a CSV file we downloaded through Dukascopy) in the expert/files folder. It’s advisable to rename it according to the name of the currency pair, for example, GBPUSD.csv
Start the terminal, go Tools -> Options
Select the Expert Advisors tab and check the boxes as shown below. Click OK.

4

Open the chart of the currency pair for which we’ve downloaded a tick history, and change the schedule timeframe for desired for testing (for example, if you want to test an expert on M5, you should change the timeframe to five minutes one).

Click the plus sign in front of the Scripts section in the navigator panel, and drag CSV2FXT with a mouse on the chart.

The Setup window will appear:

The Setup window will appear:

CsvFile: If you’ve renamed the CSV file by a name of a currency pair (like GBPUSD.csv), leave it empty. If not, write the file name here.
CreateHst: For the first time select “true”. In the future, you should switch on the parameter only if the story loaded for the pair is longer than the previous one.
StartDate and EndDate: Put the dates of starting and ending the test period in the format YYYY/MM/DD. If you don’t fill in these fields, all data available in the .CSV file will convert.
Spread: If you don’t change this parameter, then the spread will be the same as that one of your broker during creating the .FXT file; if you change it, the value you specified will be used.
GMTOffset: By default, the original data on Dukascopy has GMT 0. But you can set a different value of the script, and the data will have the selected shift.
When testing the EA, you can set the necessary shift from GMT, which was in your script (by default: 0).

Click OK. Now you need to wait (up to half an hour) until the script will convert the data.

5. After completion of the conversion process, the script will propose us to distribute the received files to the proper folders of the terminal:

After completion of the conversion process, the script will propose us to distribute the received files to the proper folders of the terminal:

Agree by clicking Yes.

Note: to perform the next item, Microsoft Visual C++ 2010 must be installed on your computer (you should download it for X86/X64)

6. Download the Tick Data Suite Program and install it in the root directory of the terminal for which the tick history was prepared. At the first start, Tick Data Suite will ask you to enter a key. The trial key is issued here. Run tds.exe as administrator from the folder with the terminal. The program will automatically start and patch the terminal so that it can work with the tick history.

7. Open the Strategy Tester and proceed to testing.

P.S. It should be noted that even at 99% backtest may give not the same result, which was in reality, therefore, you shouldn’t rely entirely on the strategy tester. Nothing can replace a real-time test on a real account.

Download Scripts

Sincerely yours, Pavel Vlasov
Tlap.biz

 

It's only fair to share...Share on Facebook
Facebook
Tweet about this on Twitter
Twitter
Share on Reddit
Reddit
Share on VK
VK
Print this page
Print
Trading Articles , , ,