Documentation

Last updated on 12. 12. 2018 by Kornel Mazur

Test strategy in MetaTrader 4 with tick precision

New Strategy Quant X Data Manager as well as QuantDataManager now allows you to export special FXT & HST files for MetaTrader 4 that allow you to test your strategies in MT4 with the highest possible modeling quality.

It does it by exporting tick data from StrategyQuant and using them in MT4 Strategy Tester.

Step 1: Export FXT & HST data to MetaTrader4

Go to Data manager, choose some tick data and click on Export to MT4 (FXT & HST) button on the toolbar.

This will open a new dialog where you must specify more details.

First of all you should specify the date range to be exported.

If you are doing it for the very first time, you also must specify the path to your MetaTrader4 installation. SQ X needs it so that it generates the files in the appropriate folders.

The last thing is to choose the correct MT4 symbol and its setting on the lower half of the dialog.
The symbol is usually recognized automatically, but if you use some exotic forex symbol you might need to choose the symbol yourself and even perhaps export the actual settings of your MetaTrader. This is explained more in the Troubleshooting section.

When everything is configured properly click on Start export. Data Manager will now start generation of FXT & HST files that will be used in MT4 Strategy Tester to achieve high quality backtest.

Note! You must turn off MetaTrader before export, otherwise there might be errors in the exported files.

Step 2: Start MetaTrader and run strategy backtest

Start your MetaTrader, open Strategy Tester, choose some strategy to be tested and the symbol you just exported. You can leave the Use date unchecked – it will perform test on the whole exported data.
When your backtest finishes go to Report and you should see that the backtest was made with 99% modeling quality.

Possible issue – Custom MT4 settings or missing symbol

When you use some exotic symbol or you want to use exactly the same trading settings as in your MT4 installation you can use our script to export your MT4 symbols details.

To do that you have to run our specila script that exports MT4 symbol detalt to a file for use in Data manager.

The custom script is in folder {SQ installation}/custom_indicators/MetaTrader4/Scripts, it is named ExportProperties.mq4

Copy this script to your {MT4 Data folder}/MQL4/Scripts folder and restart MetaTrader.

Now you must start the script on any open chart. You can do this by going back to MetaTrader, finding the script in the Navigator and drag & drop it to some chart.

IMPORTANT NOTE: Make sure that your MetaTrader is connected to the broker, otherwise it wouldn’t work!

When the script finishes it will export the properties of configured symbols to a file {MT4 Data folder}/MQL4/Files/mt4.properties

Copy this file to some folder where you can easily find it later.

Now in the Step 1 where you configure your export click on the link Load other MT4 data specification file and find your file.

It will load your newly generated file with the current properties for every symbol in your MetaTrader. Then just chose the right symbol, click Export and it is done.

Possible issue – Backtest doesn’t produce trades or there are errors in the Journal

Backtest doesn’t produce trades or there are many errors in the Journal.

Most probable reason is that the properties of the symbol used during FXT export don’t match settings of your broker. You have to export your own symbol properties from MT4 and use them in Data manager using the steps described in Possible problem 1.

Possible issue – Modelling quality is n/a

Sometimes the modeling quality in MT4 results page isn’t shown as 99%, but as n/a.

This is less serious than it seems, it means that MetaTrader is unable to determine the modeling quality. We haven’t found a reason why it sometimes happens, it seems it is related to particular MT4 installation.

However, as we see in the picture above, despite modelling quality being n/a there are no errors, and the whole modeling bar is green.
So it means the backtesting worked on real tick data with no errors, it is a problem of MetaTrader that it cannot compute the correct modelling quality for some reason.

It is usually an issue in the particular MetaTrader installation, another installation of MetaTrader running on the same FXT data will return 99% modeling quality.

Above is a screenshot of two different MT4 installations testing the same strategy on the same data.
First has modeling quality 99%, second hs n/a, but as you can see the ticks modelled and strategy results are exactly the same.

To sum it up – you don’t need to worry about n/a modeling quality if there are no chart errors and the whole bar is green.

Was this article helpful? The article was useful The article was not useful

Subscribe
Notify of
42 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
kingsman
kingsman
26. 6. 2019 12:17 pm

I Can’t find ExportProperties.mq4. Can someone share that file with me? Thanks in advance.

Mark Fric
Mark Fric
Reply to  kingsman
2. 7. 2019 10:22 am

this script is located in folder {StrategyQuant}\custom_indicators\MetaTrader4\scripts in your StrategyQuant X installation.

zhuzhiqiang
zhuzhiqiang
4. 12. 2019 6:28 am

Hi admin

After buying the software, I wrote mail to the Hong Kong support team in yesterday, but I haven’t received a reply yet. I wonder if we can get a solution here.
Fault description:
After import, the following failure information appears in the log file with MT4 sample EA.
19:00:05 MACD Sample USDCHF,M1: OrderModify error 130
19:00:10 MACD Sample USDCHF,M1: OrderModify error 130
19:00:10 MACD Sample USDCHF,M1: OrderModify error 130
Although I found the description of the problem on the official website, I could not find the solution.So can you give me a solution?
thank you

tomas262
tomas262
Reply to  zhuzhiqiang
22. 1. 2020 8:27 pm

Hello, the error 130 means: “invalids stops” and is more related to the strategy than data used. You can provide the strategy to us and we can check support.com

Lukasz Bajor
Lukasz Bajor
24. 1. 2020 2:03 am

I Can’t find ExportProperties.mq4. Can someone share that file with me? Thanks in advance. I have only got QDM pro license and not strategy quant

tomas262
tomas262
Reply to  Lukasz Bajor
24. 1. 2020 9:50 pm

Hi, this script is located in folder {QuantDataManager}\custom_indicators\MetaTrader4\scripts in your QuantDataManager installation.

MacMil
MacMil
11. 2. 2020 5:33 pm

Why the error “Invalid MT4 data specification file.” ? How to fix? What am I doing wrong?

tomas262
tomas262
Reply to  MacMil
11. 2. 2020 9:17 pm

Hello, did you create the MT4 data specification file using the ExportProperties.mq4 script?

MacMil
MacMil
Reply to  tomas262
12. 2. 2020 8:03 am

yes I created. Here is my appeal . I did everything according to the instructions . https://roadmap.strategyquant.com/tasks/qdm_0117

MacMil
MacMil
Reply to  MacMil
12. 2. 2020 8:16 am

rechecked everything. It turned out that the wrong file was uploaded. you have to be careful! =)))
Works!

Raymond
Raymond
6. 9. 2021 2:01 pm

Pls advise how to export the tick data to Mac version MT4, Thanks!

giovanni
giovanni
15. 11. 2021 12:43 am

Hello. Talking about QDM Pro version, is it possible to export multiple symbols in a time in MT4? Thanks in advance.

Heta Saputra
Heta Saputra
22. 12. 2021 11:09 am

Can I copy the downloaded historical data from one MT4 for use in MT4 from another broker?

tomas262
Admin
Reply to  Heta Saputra
22. 12. 2021 11:53 am

We have not tested this but it could work. Simply move all HST and FXT files from one to another MT copy

Алексей
Алексей
15. 1. 2022 1:56 pm

Здравствуйте! Как почистить память диска? 24 гигабайта заняла информация за 2.5 года тиков

tomas262
Admin
Reply to  Алексей
17. 1. 2022 9:57 pm

Hi, it is very normal. Tick data is huge. Unless really necessary use M1 data instead
Привет, это очень нормально. Тиковые данные огромны. Если это действительно необходимо, используйте вместо этого данные M1.

Алексей
Алексей
Reply to  tomas262
19. 1. 2022 7:35 pm

Не, нужны именно тиковые данные. Но как потом почистить память? Где всё сохраняется?

Phuwadech Phongwuttisak
18. 2. 2022 6:03 pm

I can’t backtest the EA it says error 130,
I’ve been looking for a solution for a long time but still can’t find it and the EA I tested is a generic EA that comes with MQL5’s, name EA MACD Sample.

tomas262
Admin
Reply to  Phuwadech Phongwuttisak
18. 2. 2022 7:24 pm

Hello,
did you create custom mt4.properties file for the data export? Also on the export dialog you should set the “Name in MT4” value to “XAUUSD.bs”

Phuwadech Phongwuttisak
Reply to  tomas262
19. 2. 2022 4:09 am

I have created custom mt4.properties file for the data export done according to the document.export dialog I have done that too. data came only but can’t backtest. I Confirm that I have done all according to the document.

Phuwadech Phongwuttisak
Reply to  Phuwadech Phongwuttisak
19. 2. 2022 4:23 am

I tried changing my broker to exness, still the same result.

Roman Brazhnyk
Roman Brazhnyk
3. 8. 2022 4:07 pm

How to export the tick data to Mac version MT4? I saw responses like “there are no MT4 for Mac” etc. I have mac and I have running MT4 on it. But I am struggling to import tick data (one of the reasons – broker name cannot be defined).
Thx

update: I figure it out – it works fine, but selection of the data folder is confusing (for me “Metatrader 4” was duplicated in the path – hard to see).

Problem is resolved. Thanks

Last edited 1 year ago by Roman Brazhnyk
Alen Zadoorian
26. 8. 2022 2:28 pm

Hi,
if I execute “export properties script” on a symbol’s chart to have “properties file” is this file for just that symbol, or this file is valid for all symbols from my broker ?

tomas262
Admin
Reply to  Alen Zadoorian
26. 8. 2022 2:46 pm

The properties file includes all symbols definitions. Do not forget to stay connected to your broker when you use it & also right-click in the MT4 symbols window and choose “Show all”

Alen Zadoorian
Reply to  tomas262
26. 8. 2022 3:14 pm

thanks Tomas for help, you said “do not forget to stay connected to broker when using it”
you ment using “script” or using “saved properties file on QuataDataManager export page” ?

Alen Zadoorian
Reply to  tomas262
27. 8. 2022 6:36 am

sorry, maybe my last reply was too primitive question ,
but about time zone..does “mt4.properties” file also convert exported data time zone to my broker’s server time zone or should I convert that myself?

Pantawit Buthcham
4. 9. 2022 10:37 pm

Is it necessary to have the same time zone as the broker’s?
For example, the broker has utc+2 dts time zone.
Do we need to export timezone-converting data like a broker?

tomas262
Admin
Reply to  Pantawit Buthcham
5. 9. 2022 7:57 pm

Most definitely, you can to clone in broker’s zone before the data is exported

Francisco Contreras
Francisco Contreras
19. 9. 2022 3:39 pm

Does anyone know why in all the backtesting we do the results with correct until it reaches the end of the period. Then the graph suddenly drops and the report shows losses of almost the entire initial capital and the DD is 70%, even 80%.?

tomas262
Admin
Reply to  Francisco Contreras
3. 10. 2022 6:36 pm

Is your trade properly closed? It can happen if you hold a trade for very long time and at the test end it is terminated

Ruslan
Ruslan
24. 11. 2022 2:26 pm

Hello,
I have a problem. I want to Export S&P500 data into MT4, but after loading the MT4 data specification file (all the data appears to be correct), the statement in red appeared.
“Warning – there was a change in MT4 from Build 8xx up- it does not respect the spread setting form FXT file, insted it applies spread configured in Strategy Tester.”
Data is successfully exported, but no trades are made buring the strategy test.
Can you assist in resolving the issue?

tomas262
Admin
Reply to  Ruslan
25. 11. 2022 4:48 pm

Do you export the data from the QDM version 121? Do you also use the script for MT4 (to export properties) from the version 121? Only updated version needs to be used to do that correctly

Kevin Cheung
6. 12. 2022 10:21 am

I found this very difficult to use!!! Every single export needs to load the specification file. Always ERROR 131!!!

tomas262
Admin
Reply to  Kevin Cheung
8. 12. 2022 8:37 pm

You need to use QuantDataManager (last version – Build 121, released July 27, 2022) or any newer to export the data and use updated script – ExportProperties.mq4 in that version for your MT4

In the prev version there was an error in the export script which lead to the error 131 in MetaTrader4 when testing on exported tick data

Issac Wong
Issac Wong
6. 12. 2022 3:28 pm

Hello may i ask does this support broker with suffix/prefix?

tomas262
Admin
Reply to  Issac Wong
8. 12. 2022 8:36 pm

Yes, you need to use QuantDataManager (last version – Build 121, released July 27, 2022) or any newer to export the data and use updated script – ExportProperties.mq4 in that version for your MT4

Malee Nomsod
Malee Nomsod
31. 12. 2022 8:17 am

When the script finishes it will export the properties of configured symbols to a file {MT4 Data folder}/MQL4/Files/mt4.properties

I don’t understand this and I can’t backtest error 131.

tomas262
Admin
Reply to  Malee Nomsod
2. 1. 2023 6:37 pm

Make sure you use the update version of the script \custom_indicators\MetaTrader4\scripts\ExportProperties.mq4
together with QDM 121. If you use SQX make sure you use the updated version 136 (with the new script)

The previous versions caused the error 131

Kenji Izutani
8. 5. 2023 6:34 am

Hi, although I’ve exported tick data with “all time” for “Choose data range to export”, only about 20months data was exported. Is there any limitation of the duration of data range?
Thanks,

WJPII
8. 8. 2023 5:40 pm

I need help with an error/issue with SQX latest v136. I originally downloaded all the ticks I needed via the data manager. Then, I attempted to export those pairs/ticks via “export to csv” so that I could convert the xls files to go into MT4. I cannot use the “export to MT4” option because I do not have enough space on my c: drive for history and using the portable method of MT4 to have everything on my D: drive which is bigger. Hence, the export to mt4 option does not work because it is looking for my roaming folder… Read more »

Jiri Vorisek
Jiri Vorisek
7. 3. 2024 8:49 am

Hello, I have a problem with exporting data from QuantDataManager to MT4. I can only successfully export data for currency pairs (I tried GPBUSD and EURUSD). I cannot successfully export data for indices (I tried DAX, US500+ and US2000). I have not tried other/additional symbols yet. I am following the instructions exactly, including running the ExportProperties.mq4 script and using the created mt4.properties file in the export. However, for the indices, I don’t get any results when I backtest. The quality modeling has a full green column. The log says that the file “xxxxx+1_0.fxt” cannot be opened and that this file is… Read more »

tomas262
Admin
Reply to  Jiri Vorisek
8. 3. 2024 7:11 pm

Do you use the latest version of QDM? You can let us know to our support.com email, we will check