Advisor managing the work of other advisors

 

I wrote an Advisor that closes orders of other advisors working on the account according to the profit-loss criteria and the news feed.

However, to close the orders of the adviser before the release of important news is only half the case.

We still need to stop its work for a given interval before and after.

Using the DLL, You can disable the Autotrading button of the terminal, but I would like to selectively disable the work of a particular expert Advisor.

That is, to get access to the property of the working Advisor Alow Live Trading.

Tell me if someone has already done it.

Thanks.

 
Aleksander Gladkov:

I wrote an Advisor that closes orders of other advisors working on the account according to the profit-loss criteria and the news feed.

However, to close the orders of the adviser before the release of important news is only half the case.

We still need to stop its work for a given interval before and after.

Using the DLL, You can disable the Autotrading button of the terminal, but I would like to selectively disable the work of a particular expert Advisor.

That is, to get access to the property of the working Advisor Alow Live Trading.

Tell me if someone has already done it.

Thanks.

There are many ways this can be done using time or sleep (which google can be of help as there is alot of ea that does that )


by the way which advisors do you want to stop, the management advisors or the other advisors ?

 

Hello this is not without danger you can unwillingly create the event where one Expert is continuously opening new orders due to some valid entry rule, while the other Expert is continuously closing these orders due to some valid closing rule.

Protection against these types of runaway events is needed because when such event occurs it has the potential to drain the account in minutes.

Such mistake does only have to be made once.


If you want your experts to communicate with each other you can use global variables of the terminal these can be read and modified / written by Experts see:

https://www.mql5.com/en/docs/globals/globalvariablecheck

Or you could also read and write to a file but that is interval specific so you would be dealing with a slight delay.


In any case you would need access to the source code of both Experts.

Documentation on MQL5: Global Variables of the Terminal / GlobalVariableCheck
Documentation on MQL5: Global Variables of the Terminal / GlobalVariableCheck
  • www.mql5.com
Global Variables of the Terminal / GlobalVariableCheck - Reference on algorithmic/automated trading language for MetaTrader 5
 
Marco vd Heijden:

Hello this is not without danger you can unwillingly create the event where one Expert is continuously opening new orders due to some valid entry rule, while the other Expert is continuously closing these orders due to some valid closing rule.

Protection against these types of runaway events is needed because when such event occurs it has the potential to drain the account in minutes.

Such mistake does only have to be made once.


If you want your experts to communicate with each other you can use global variables of the terminal these can be read and modified / written by Experts see:

https://www.mql5.com/en/docs/globals/globalvariablecheck

Or you could also read and write to a file but that is interval specific so you would be dealing with a slight delay.


In any case you would need access to the source code of both Experts.

Thanks for the hint, however, the global variables of the terminal are what I created myself, and I need to access the objects created by the terminal. What I can do in the terminal interface having access to the properties of the working expert Advisor and disable its operation, I want to do programmatically. To begin with, it would be nice to create a list of all the advisors working in the terminal.

 

Ok in that case you could cycle over all open charts, by using the chart_ID and see the expert they are running but it will not be easy to interact with that EA to alter it's trade permissions, if it was not coded specifically to be of a bidirectional type.

The enable / disable auto trading button goes for the terminal and all experts at once, so not one or the other but there are some parameters that relate to the expert's permissions to trade but they appear to be read only.

You can see some examples of this halfway through the page here: https://www.mql5.com/en/docs/runtime/tradepermission

Documentation on MQL5: MQL5 programs / Trade Permission
Documentation on MQL5: MQL5 programs / Trade Permission
  • www.mql5.com
MQL5 language provides a special group of trade functions designed for developing automated trading systems. Programs developed for automated trading with no human intervention are called Expert Advisors or trading robots. In order to create an Expert Advisor in MetaEditor, launch MQL5 Wizard and select one of the two options: Expert Advisor...
 
Marco vd Heijden:

Ok in that case you could cycle over all open charts, by using the chart_ID and see the expert they are running but it will not be easy to interact with that EA to alter it's trade permissions, if it was not coded specifically to be of a bidirectional type.

The enable / disable auto trading button goes for the terminal and all experts at once, so not one or the other but there are some parameters that relate to the expert's permissions to trade but they appear to be read only.

You can see some examples of this halfway through the page here: https://www.mql5.com/en/docs/runtime/tradepermission

Thanks for your help! Found an article that contains a program that brings me closer to the goal. I will test. https://www.mql5.com/en/articles/125
The Optimal Method for Calculation of Total Position Volume by Specified Magic Number
The Optimal Method for Calculation of Total Position Volume by Specified Magic Number
  • www.mql5.com
The MetaTrader 5 client terminal allows the parallel work of several Expert Advisors with one symbol. It is simple - just open several charts and attach Expert Advisors to them. It would be nice, if each Expert Advisor worked independently from the other Expert Advisors working with the same symbol (there is no such a problem for Expert...