Starting strategy tester through command line parameters?

Adam Parusel
60
Adam Parusel  

Is there a possibility to start a backtest from the command line? Something like "terminal.exe -tester EAxyz EURUSD 5min 2000.01.01 2010.01.01" ?

Any other idea, how I could start a backtest from outside? I want to use external programs that start different backtests automaticaly. But I have not found a solution yet... any ideas welcome!

Adam Parusel
60
Adam Parusel  

I have found something in the help documentation of the terminal. F1 (Help) -> Tools -> Configuration at Startup:

Settings of the Strategy Tester Launch

  • TestExpert - the name of the expert to be launched for testing. If this parameter has not been specified, no testing is launched.

  • TestExpertParameters - the name of the file containing parameters (the \tester directory). The file can be created in the Properties window of the expert under test by clicking the "Inputs - Save" button. It is normally used to save parameters other than the default ones. Other parameters of the expert under test in the "Testing" and "Optimization" tabs (as well as in the "Inputs" tab if this parameter has not been specified) are filled up with the values automatically saved in the \tester\[the expert name].ini file after the latest test.

  • TestSymbol - the name of the symbol used for the expert testing. If this parameter has not been specified, the latest value used in the tester is used.

  • TestPeriod - the chart period (M1, M5, M15, M30, H1, H4, D1, W1, MN). If this parameter has not been specified, H1 is used.

  • TestModel - 0, 1, or 2, depending on the testing model (Every tick, Control points, Open prices only). If this parameter has not been specified, 0 is used (Every tick).

  • TestOptimization - enable/disable optimization. The values that can be taken are "true" or "false". If this parameter had not been specified, the "false" value is used.

  • TestDateEnable - enable/disable the "Use date" flag. The values that can be taken are "true" or "false". If this parameter had not been specified, the "false" value is used.

  • TestFromDate - the date, from which to start testing, appeared as YYYY.MM.DD. If this parameter has not been specified, this date is 1970.01.01.

  • TestToDate - the date, on which to finish testing, appeared as YYYY.MM.DD. If this parameter has not been specified, this date is 1970.01.01.

  • TestReport - the name of the test report file. The file will be created in the client terminal directory. A relative path can be specified, for example: tester\MovingAverageReport". If the extension has not been specified in the file name, the ".htm" will be set automatically. If this parameter has not been specified, the test report will not be formed.

  • TestReplaceReport - enable/disable the repeated report file record. The values that can be taken are "true" or "false". If the "false" value is specified and a report file named in the same way exists already, the number in square brackets will be added to the file name. For example, "MovingAverageReport[1].htm". If this parameter had not been specified, the "false" value is used.

  • TestShutdownTerminal - enable/disable shutdown of the terminal after the testing has been finished. The values that can be taken are "true" or "false". If this parameter had not been specified, the "false" value is used. If the user has pressed the "Stop" button, the value of this parameter will be flushed to "false" since the control has been given to the user.

Example:

  ; start strategy tester
  TestExpert=Moving Average
  TestExpertParameters=ma0.set
  TestSymbol=EURUSD
  TestPeriod=H1
  TestModel=2
  TestOptimization=false
  TestDateEnable=true
  TestFromDate=1970.01.01
  TestToDate=2006.06.06
  TestReport=MovingAverageReport
  TestReplaceReport=false
  TestShutdownTerminal=true
[Deleted]  
adamp:

Is there a possibility to start a backtest from the command line? Something like "terminal.exe -tester EAxyz EURUSD 5min 2000.01.01 2010.01.01" ?

Any other idea, how I could start a backtest from outside? I want to use external programs that start different backtests automaticaly. But I have not found a solution yet... any ideas welcome!




It is absolutely possible, I do it all the time.

Start your journey here: Automated Optimization of a Trading Robot in Real Trading

There are some issues (bugs) with the original code but nothing that will stop you from getting your feet wet and your system up and running. (be syure and read the comments section)

Once you've played around with it for a while and developed a working knowledge of how it all works then feel free to come back and hit me up for some further discussion.

I'll happily share my experiences with you but if I threw it all at you right now it would be a waste of both your time as well as mine.

But yes, rest assured the hill you are contemplating climbing is indeed doable.
mikeitexpert
52
mikeitexpert  

let say I have an excel file of time, open, high, low and close values, is it possible to run the strategy tester from command line and get some other columns for let other indicators, and EA in a new or same excel file?


I just need to test my EA for specific OHLC data scenarios.


Please let me know thank you

memo_mqlcom
37
memo_mqlcom  
Phillip:



It is absolutely possible, I do it all the time.

Start your journey here: Automated Optimization of a Trading Robot in Real Trading

There are some issues (bugs) with the original code but nothing that will stop you from getting your feet wet and your system up and running. (be syure and read the comments section)

Once you've played around with it for a while and developed a working knowledge of how it all works then feel free to come back and hit me up for some further discussion.

I'll happily share my experiences with you but if I threw it all at you right now it would be a waste of both your time as well as mine.

But yes, rest assured the hill you are contemplating climbing is indeed doable.
@Phillip thank you for this info you've provided 10 years ago! It's still useful in 2020 ;) I figured out how to initiate tests on command line, but they only generate the standard report in ".htm" format. Are you aware of a way to generate test reports in CSV or another format that's more parsable than htm? Any other suggestions to get the results in a more structured way?
kasinath
165
kasinath  
memo_mqlcom:
@Phillip thank you for this info you've provided 10 years ago! It's still useful in 2020 ;) I figured out how to initiate tests on command line, but they only generate the standard report in ".htm" format. Are you aware of a way to generate test reports in CSV or another format that's more parsable than htm? Any other suggestions to get the results in a more structured way?
I'm happy to have found this thread as well. 

To get your report in CSV, you could write a script to pull out the results data from the htm report and convert it to CSV. You could also add logic to the EA you are testing, that creates a csv file and writes to it.
Pro-Berza
3942
Philip Meijer  

Hi guys,

Anyone knows if starting the MT4 strategy tester from the command line has been depreciated?

Based upon the above posts i guess not but i cannot get it to work, all i get is the terminal being started but the tester isnt showing in any way.

below is my ini file which i try to use to get the tester to run:

; start strategy tester
TestExpert=TestEA
TestExpertParameters=paramset.set
TestSymbol=EURUSDi
TestPeriod=M5
TestModel=2
TestSpread=0
TestOptimization=false
TestDateEnable=true
TestFromDate=2020.01.01
TestToDate=2020.06.06
TestReport=EURreport
TestReplaceReport=true
TestShutdownTerminal=true

then i start it using the cmd line

"C:\Program Files\ICMarketsMT4\terminal.exe" /config:d:\myini.ini

I must have made some error or typo but im not seeing it. Can anyone point me in the right direction?


Thanks,

Phil

Pro-Berza
3942
Philip Meijer  
Philip Meijer:

Hi guys,

Anyone knows if starting the MT4 strategy tester from the command line has been depreciated?

Based upon the above posts i guess not but i cannot get it to work, all i get is the terminal being started but the tester isnt showing in any way.

below is my ini file which i try to use to get the tester to run:

then i start it using the cmd line

I must have made some error or typo but im not seeing it. Can anyone point me in the right direction?


Thanks,

Phil

got it to work.


Somehow i thought we needed to have the /config preceding the ini file but i must be wrong though the help https://www.metatrader4.com/en/trading-platform/help/service/start_conf_file gives this in the example.

In my case it worked like the below

"C:\Program Files\ICMarketsMT4\terminal.exe" d:\myini.ini

Thanks

Configuration at Startup - Tools - MetaTrader 4 Help
Configuration at Startup - Tools - MetaTrader 4 Help
  • www.metatrader4.com
The client terminal can be launched with some predefined settings. For this purpose, the configuration file name will be passed to the client terminal as a parameter. If the full path to the file (Drive:\SubDirectory\FileName) is not given, the file will be searched for in the client terminal's data folder. The configuration file contains lines...
hPafF
6
hPafF  

Hello together,

I can open the terminal with the command , but I get each time the window to login with my account.

"path/terminal.exe" path\common.ini

I have in among others the following lines in the common

[Common]
Environment=very long number
Login=Number of account
ProxyEnable=0
ProxyType=0
ProxyAddress=
ProxyAuth=
CertInstall=0
NewsEnable=1
NewsLanguages=

The path are correct, because I checked it. Can someone help me? Is a line missing? Which variables contain you *.ini file?


Thanks in advance for your answers.
hPafF
6
hPafF  
My solution was to install MT5 new and then it works fine.
agavaqif
23
agavaqif  

guys I can start MT5 from command line like "path\terminal64.exe" config: "configpath" 
But this just starts mt5 it does not run strategy tester. Is there any way to directly run ST from command line?