I don’t usually comment on articles, but this one deserves a comment. Well done. Well done!
There is one point the author did not mention.
If you run the script from the config file (not for testing or optimisation using historical data, but specifically the script using current data!), the terminal continues to run once the script has finished executing.
If you insert the following lines at the end of the script
if(MQLInfoInteger(MQL_STARTED_FROM_CONFIG)) TerminalClose(some_return_code);
the client terminal will be shut down once the script has finished running.
Furthermore, the exit code can be processed in the terminal’s launch batch file.
Slava used to launch the terminal.
Thanks, Slava, I’d missed that...
Slava used to launch the terminal.
I have updated and expanded the article in the ‘Programmatic processing of startup from a configuration file’ section.
Thank you, Slava.
Автоматизация запуска терминала для выполнения сервисных задач
- 2025.11.14
- www.mql5.com
В статье рассмотрим возможность запуска терминала с конфигурационным файлом для выполнения автоматизированных рутинных задач, программную обработку такого запуска, и создадим полноценную систему автооптимизации советника средствами ОС Windows.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Check out the new article: Automating Terminal Startup for Service Tasks.
Let's imagine this situation: We have a simple trading EA running all the time and would like to re-optimize it from time to time based on the most recent trading history. This means that we should periodically, for example, once a week or a month, run the optimization of its parameters and look at the results for new optimal settings for its parameters. This process can be automated so that the client terminal launches automatically, for example, on weekends at a specified time, runs our EA in the optimizer, and creates an XML file based on the results, from which we can select the desired optimal parameter values. Once optimization is complete and the report file is generated, the terminal closes, and all we have to do is launch the report file from the terminal data folder to analyze it.
In addition, if the EA, when launched from the configuration file in the tester, should do additional things, but at the same time should avoid doing the same things in the combat mode, then we can, by analyzing the MQL_STARTED_FROM_CONFIG flag, make a branch in the program to handle such a launch. This could be, for example, an analysis of the latest trading history, taking screenshots of the screen with trades, and so on. We can easily do all this using the new capabilities of the client terminal.
Author: Artyom Trishkin