MT5 - Terminal.exe exit code for automation

 

Question:

Does terminal.exe return an exit code other than 0?

Description:

I'm using python to automate optimizations. An optimization will fail, for example, when none of the parameters are selected for optimization. The journal gives this message:

2018.01.24 10:58:52.653 Tester  no optimized parameter selected, please check input(s) to be optimized and set start, step and stop values

And it appears that terminal.exe returns a 0.

If the optimization runs, terminal.exe likewise returns a 0.

I searched for documentation on terminal.exe command line parameters, but the only reference that I have found is here, and it does not describe terminal.exe exit codes:

https://www.metatrader5.com/en/terminal/help/start_advanced/start#command_line

Is this the expected behavior?

Oh, my python code in case I made some sort of mistake . . . .

import subprocess
import os

TERMINAL = "C:\\Program Files\\MetaTrader 5\\terminal64.exe"
TESTER_INI = os.getcwd() + "\\tester.ini"
CONFIG_LINE = '/config:' + TESTER_INI
#print(TERMINAL + " " + CONFIG_LINE)

retcode = subprocess.call([TERMINAL, CONFIG_LINE])
print(retcode)
 

Never heard about a way to fix a return code. Probably something to confirm with the Service Desk.

 
Alain Verleyen:

Never heard about a way to fix a return code. Probably something to confirm with the Service Desk.

Roger that. Thanks @Alain
 
I will choose another way to get the parameters.
 

Hi!

if ..

C:\\Program Files\\MetaTrader 5

is your installation, I think you have to create oder modify a .set file in this foler:

C:\\Program Files\\MetaTrader 5\MQL5\Profiles\Tester

You can create a set file which you have to select in your ini or you can modify the (mostly) existing set-file of your EA.

Reason: