Is Optimization=3 supported when launching MetaTrader 5 Strategy Tester from command line?

 

Hello,

I am testing automation of the MetaTrader 5 Strategy Tester using:

terminal64.exe /config:path_to_config.ini

Single-symbol tests and standard optimizations can be launched this way, but I have not been able to clearly confirm the behavior of:

Optimization=3

which corresponds to “All symbols selected in Market Watch”.

Example configuration:

[Tester]
Expert=MyEA.ex5
Symbol=EURUSD
Period=M1
Optimization=3
Model=1
FromDate=2020.01.01
ToDate=2026.01.01
ExpertParameters=my_set.set
Report=report.xml
ShutdownTerminal=1

The points I would like to clarify are:

  1. Is Optimization=3 officially supported when the tester is launched through /config ?

  2. When started from command line, how does MetaTrader 5 determine the symbol list for this mode?
    Does it use the current Market Watch selection, the last saved Market Watch state, or some other internal state?

  3. Is there any reliable way to prepare or load a specific Market Watch symbol set before launching the terminal with /config ?

  4. Are reports generated correctly when using Optimization=3 from command line?

  5. Does this mode only run the same fixed input parameters across the selected symbols, or can it also be combined with normal parameter optimization?

  6. Are there any known limitations compared with launching “All symbols selected in Market Watch” manually from the Strategy Tester GUI?

  7. If this mode is not reliable or not officially supported through /config , is the recommended approach to launch separate tester runs symbol by symbol through external orchestration?

Any official clarification or practical experience would be appreciated.

Thank you.

 
Try to look at the MultiTester.
MultiTester
MultiTester
  • 2025.04.04
  • www.mql5.com
Multiple runs/optimisations in Tester.
 
Stanislav Korotky #:
Try to look at the MultiTester.
Thank you very much. Yes, I know it, but it's not suitable for this case, and I've also run tests using system code, but when I select optimization method number 3, the Market Watch symbols aren't used. I still appreciate your response. I'm almost certain it can't be done, but I thought I'd share in case anyone else could offer some input.
 
Enrique Enguix:
Does this mode only run the same fixed input parameters across the selected symbols, or can it also be combined with normal parameter optimization?

Did you check if you can optimize using “All symbols selected in Market Watch”. mode? If it can not be done in the terminal itself, then it also can not be done from the command line.

Explain your use case. As far as i can tell from your questions, you want to optimize an a set of symbols? Then all symbols mode is not what you want.

Multitester can do basically everything you can dream of fully automated.

 
Enrique Enguix:

Hello,

I am testing automation of the MetaTrader 5 Strategy Tester using:

terminal64.exe /config:path_to_config.ini

Single-symbol tests and standard optimizations can be launched this way, but I have not been able to clearly confirm the behavior of:

Optimization=3

which corresponds to “All symbols selected in Market Watch”.

Example configuration:

The points I would like to clarify are:

  1. Is Optimization=3 officially supported when the tester is launched through /config ?

  2. When started from command line, how does MetaTrader 5 determine the symbol list for this mode?
    Does it use the current Market Watch selection, the last saved Market Watch state, or some other internal state?

  3. Is there any reliable way to prepare or load a specific Market Watch symbol set before launching the terminal with /config ?

  4. Are reports generated correctly when using Optimization=3 from command line?

  5. Does this mode only run the same fixed input parameters across the selected symbols, or can it also be combined with normal parameter optimization?

  6. Are there any known limitations compared with launching “All symbols selected in Market Watch” manually from the Strategy Tester GUI?

  7. If this mode is not reliable or not officially supported through /config , is the recommended approach to launch separate tester runs symbol by symbol through external orchestration?

Any official clarification or practical experience would be appreciated.

Thank you.

1. Yes.

2. Yes current Market Watch.

3. I don't think it's possible but I could be wrong.

4. Yes, they are saved in [Path]Terminal\[UUID] folder (by default).

5. Yes same parameters for all symbols, you can't combine with parameters optimization.

6. No.

7. Irrelevant, it works.

 

Hello, @Alain Verleyen, @Enrique Dangeroux, @Stanislav Korotky

I have to admit that I was probably wrong in my previous assumption.

The implementation I had programmed did not work correctly, and I have not yet isolated the exact reason. However, after reducing the test to a very simple PowerShell command that creates a minimal tester configuration and launches MetaTrader 5 with:

Optimization=3

it does work.

So the problem was not necessarily that Optimization=3 cannot be launched from command line. The error seems to be somewhere else in my own automation workflow, probably in the way I was generating the configuration, preparing the environment, handling the report, or controlling the terminal process.

Thank you all for your help and for pointing me in the right direction.

PowerShell:

powershell -NoProfile -ExecutionPolicy Bypass -Command "$mt5=(Get-ChildItem 'C:\Program Files','C:\Program Files (x86)' -Filter terminal64.exe -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1).FullName; if(!$mt5){throw 'No encuentro terminal64.exe'}; $ini=Join-Path $env:TEMP 'mt5_opt3_marketwatch.ini'; @'[Tester]
Expert=Examples\MACD\MACD Sample
Symbol=EURUSD
Period=M1
Model=1
Optimization=3
OptimizationCriterion=7
FromDate=2020.01.01
ToDate=2026.01.01
Report=mt5_opt3_marketwatch
ReplaceReport=1
ShutdownTerminal=0
UseLocal=1
UseRemote=0
UseCloud=0
Visual=0
'@ | Set-Content -Path $ini -Encoding ASCII; Write-Host ('INI: '+$ini); Start-Process -FilePath $mt5 -ArgumentList ('/config:'+$ini)"