Documentation
Applications
Last updated on 12. 12. 2018 by Kornel Mazur
Test strategy in MetaTrader 4 with tick precision
Page contents
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
I Can’t find ExportProperties.mq4. Can someone share that file with me? Thanks in advance.
this script is located in folder {StrategyQuant}\custom_indicators\MetaTrader4\scripts in your StrategyQuant X installation.
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
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@strategy quant.com
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
Hi, this script is located in folder {QuantDataManager}\custom_indicators\MetaTrader4\scripts in your QuantDataManager installation.
Why the error “Invalid MT4 data specification file.” ? How to fix? What am I doing wrong?
Hello, did you create the MT4 data specification file using the ExportProperties.mq4 script?
yes I created. Here is my appeal . I did everything according to the instructions . https://roadmap.strategyquant.com/tasks/qdm_0117
rechecked everything. It turned out that the wrong file was uploaded. you have to be careful! =)))
Works!
Pls advise how to export the tick data to Mac version MT4, Thanks!
Hello. Talking about QDM Pro version, is it possible to export multiple symbols in a time in MT4? Thanks in advance.
Can I copy the downloaded historical data from one MT4 for use in MT4 from another broker?
We have not tested this but it could work. Simply move all HST and FXT files from one to another MT copy
Здравствуйте! Как почистить память диска? 24 гигабайта заняла информация за 2.5 года тиков
Hi, it is very normal. Tick data is huge. Unless really necessary use M1 data instead
Привет, это очень нормально. Тиковые данные огромны. Если это действительно необходимо, используйте вместо этого данные M1.
Не, нужны именно тиковые данные. Но как потом почистить память? Где всё сохраняется?
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.
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”
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.
I tried changing my broker to exness, still the same result.
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
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 ?
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”
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” ?
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?
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?
Most definitely, you can to clone in broker’s zone before the data is exported
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%.?
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
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?
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
I found this very difficult to use!!! Every single export needs to load the specification file. Always ERROR 131!!!
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
Hello may i ask does this support broker with suffix/prefix?
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
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.
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
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,
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 »