Thanks for the article. Special thanks for the link to the library of changing states of the Expert Advisor. Working through templates is a very original solution indeed.
But to be honest, when I saw the title I thought it would be something about client server or sockets....
If you have several accounts, you will get tired of putting pending orders everywhere.
Somewhere on the forum there was a library for interaction via telegram. There are more possibilities there, and all commands can be set by pressing pre-prepared buttons in the bot.
Thanks for the article. Special thanks for the link to the library of changing states of the Expert Advisor. Working through templates is a very original solution indeed.
But honestly speaking, having seen the title I thought it would be something about client server or sockets....
If you have several accounts, you will get tired of putting pending orders everywhere.
Somewhere on the forum there was a library for interaction via telegram. There are more possibilities there, and all commands can be set by pressing pre-prepared buttons in the bot.
As far as I know, there are plans to prepare an article on management via telegram and even an author has been appointed. Perhaps the new article will be more useful to you.
#define private public #include <fxsaber\Expert.mqh> // https://www.mql5.com/en/code/19003 #undef private #define STRING_END "\r\n" #define EXPERT_BEGIN ("<expert>" + STRING_END) #define EXPERT_END ("</expert>" + STRING_END) #define EXPERT_NAME "name="
Thus, to enable/disable the Expert Advisor, we only need to rewrite the template file, changing the expertmode flag to the value we need and removing hidden objects.
I did not know about this flag, as well as did not think about the subtleties of working with objects, Thank you!
This code
string temp=EXPERT::TemplateToString(i_chart,true); if(temp==NULL) { i_chart=ChartNext(i_chart); continue; } //--- temp=EXPERT::StringBetween(temp,EXPERT_BEGIN,EXPERT_END); if(temp==NULL) { i_chart=ChartNext(i_chart); continue; }
will catch not only EAs, but also scripts. That's why it's probably better like this
if(!EXPERT::Is(i_chart)) { i_chart=ChartNext(i_chart); continue; } string temp=EXPERT::TemplateToString(i_chart,true);
In this case, templates will be saved only where they are needed.
ZY I didn't intentionally make FileDelete so that you could always see the last generated template.
You can use such a technique to not change the original source material
Interesting technique, never thought of this way before. Thank you.
This code
will catch not only EAs, but also scripts. That's why it's probably better like this
In this case, templates will be saved only where they are needed.
In the code, TemplateToString was intentionally called with the flag true. Perhaps you have forgotten, but in the body of the function with the true flag, the presence of the Expert Advisor on the chart is checked by calling the Is method.
static string TemplateToString( const long Chart_ID = 0, const bool CheckExpert = false ) { short Data[]; return(((!CheckExpert || EXPERT::Is(Chart_ID)) && ::ChartSaveTemplate((ulong)Chart_ID, PATH + FILENAME) && (::FileLoad(FILENAME, Data) > 0)) ? ::ShortArrayToString(Data) : NULL); }
That's why both codes should work the same way.
In general, thank you for the library and your comments.
Regards,
Dmitry.
In the code, TemplateToString was intentionally called with the true flag. Perhaps you have forgotten, but the presence of an Expert Advisor on the chart is checked by calling the Is method in the body of the function with the true flag.
Indeed, I forgot.
In general, thank you for the library and your comments.
I'm glad that you have understood it and added substantially. Indeed, it wouldn't hurt to correct it taking into account the nuances you mentioned.
It happens that VPS (or your PC at home) with the Expert Advisor is offline for some time for technical reasons. It is unknown when it will be back online, but you need, for example, not to trade, because you know that there may be more interruptions. In this case, the proposed remote control allows much more than your variant.
There are also VPS from MetaQuotes. It's only like that there.
This will not happen for one reason, there is no internet - no trading, and you probably have not noticed that account control is visible from your phone or tablet. If the internet is out, we just close all trades with our hands, and then either wait for the internet to appear or be at home for further actions on the PC.
Terminal on your computer without internet, you are far away. You have access to your account, but not to the terminal with the Expert Advisor. How to make the Expert Advisor not to trade, when it will be connected to the trading server (internet will work)?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
New article EA remote control methods has been published:
The main advantage of trading robots lies in the ability to work 24 hours a day on a remote VPS server. But sometimes it is necessary to intervene in their work, while there may be no direct access to the server. Is it possible to manage EAs remotely? The article proposes one of the options for controlling EAs via external commands.
Various automated systems for trading in financial markets have become quite common in our digital age. The main advantages of electronic Expert Advisors (EAs) are considered to be flawless algorithm execution and working 24 hours a day. The virtual hosting allows using EAs autonomously around the clock.
Unfortunately, not all EAs work equally well in any market situations. In these cases, traders often need to enable and disable them manually. This is easy when a user has direct access to the terminal. But what if you do not have quick access to the terminal with a working EA? In such cases, it would be good to be able to remotely control the EA operation. Let's consider one of the possible methods of EA remote control in the terminal.
Author: Dmitriy Gizlyk