How to Launch the StrategyTester from a script/EA?

 

Hello all,

I would like to be able to launch the StrategyTester, so I can program backtests in different dates/currencies and leave the computer testing over night. Is there anyone that coud help with this?


This is my code:

#import "shell32.dll" 
int ShellExecuteW(int hwnd,string operation,string file,string parameters,string directory,int showCmd); 
#import

#define SW_SHOWNORMAL       1

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
{
   string initFileDir = " C:\\Forex\\optimize.ini";
   int result = ShellExecuteW(0, "open",TerminalPath()+"terminal.exe", initFileDir, NULL, SW_SHOWNORMAL);  
}

and this is the content of the optimize.ini as it is described in the help Topic/Tool/Configuration at StartUp. The problem is that since this is not a start up the code is not working. If I execute the terminal.exe from cmd passing the file the tester  is being launched, but this does not give the felxibility that I am looking for.



 ; start strategy tester
 ExpertsEnable=true
 TestExpert=Attar Day Breaker_v1.ex4
 TestExpertParameters=Attar Day Breaker_v1.ini
 TestSymbol=EURUSD.r
 TestPeriod=D1
 TestModel=2
 TestSpread=2
 TestOptimization=true
 TestDateEnable=true
 TestFromDate=2020.03.07
 TestToDate=2020.12.22
 TestReport=FileReport_USDCHF_2020.12.22.html
 TestReplaceReport=true
 TestShutdownTerminal=False


Thank you in advance,
Cheers :)

 
https://www.mql5.com/ru/code/26132
MultiTester
MultiTester
  • www.mql5.com
Множественные прогоны/оптимизации в Тестере.
 
fxsaber:
https://www.mql5.com/ru/code/26132

Thank you for your contribution. I forgot to mentioned that I am using mt4.


In any case for those that are looking for an automated solution to launched the Strategy tester, the workaround I found is through a batch file(code below) where I launch the teminal with an startup file (see my post above or the documentation of the terminal)

cd C:\Program Files (x86)\MyBrokerFolder

terminal.exe C:\Myfolder\MyInitializationFile.ini