Automated Optimisation

 
From a running EA, I am trying to start a second MT4 terminal which then should run its Optimiser and return the results as a report.
The idea for this I took from the article Automated Optimization of a Trading Robot in Real Trading (https://www.mql5.com/en/articles/1467) dating back to 2007 but still very valuable imho.

The file optimise.ini is located in the same folder as terminal.exe and contains:

;optimise strategy tester
ExpertsEnable=false
TestExpert=MACD Sample_1
TestExpertParameters=MACD Sample_1.set
TestSymbol=EURUSD
TestPeriod=240
TestModel=0
TestRecalculate=false
TestOptimization=true
TestDateEnable=true
TestFromDate=2021.01.22
TestToDate=2021.01.25
TestReport=FileReport_EURUSD_2021.01.25.htm
TestReplaceReport=true
TestShutdownTerminal=true

The essence of the code looks like this:

string IniFile           = "optimise.ini";
string ReportDestination = "Reports";
string PathToTester      = "C:\Program Files (x86)\MetaTrader - ActivTrades\terminal.exe";
start = ShellExecuteW(0,"Open",PathToTester,IniFile,ReportDestination,3);

The result is that the terminal starts, but it does not run the optimiser.
What could possibly be wrong?

In addition: it doesn't work from the command line either:

terminal.exe /config:optimise.ini


Thank you for looking into this!

Automated Optimization of a Trading Robot in Real Trading
Automated Optimization of a Trading Robot in Real Trading
  • www.mql5.com
The articles describes and provides a library of functions that allows a trader to optimize his or her Expert Advisor's inputs by launching optimization directly from the EA.
Reason: