@ambrogio I'm not experienced at all
yet I will write here... found these.
I posted this on your other thread as well, so this is a duplicate.
Maybe someone more experienced can compile a working Custom mql from all these examples. Looking at all these, I guess the chart way is the way.
.................................
@ambrogio I did some documentation and I found all these...
There is some code down here, and I'm thinking setting up a boolean if that's possible.
https://docs.mql4.com/runtime/tradepermission
But closing Auto trading feature would terminate the handler EA itself.
So maybe trying to get the magic number of the running EAs and terminate those only would be great. Then in this Handler EA, you could even set up some conditions to check for a certain market context, and make some kind of a Manager EA.
Also, another way to go, would be to close certain charts. Closing the chart with some EA, closes the respective EA as far as I know.
... Or I found this
// Deletes the Expert Advisor form the appropriate chart
bool EXPERT::Remove( const long Chart_ID = 0 );
don't know if this is for mt4 or mt5.
Also...
It says here
https://www.metatrader4.com/en/trading-platform/help/autotrading/experts/experts_remove
that "the expert can be removed from the chart at profile or template change" so there could be a function to change template on some chart, also.
Examples here
https://www.mql5.com/en/docs/chart_operations/chartapplytemplate

piece by piece: CheckDailyFXNews, CheckInvestingNews, etc... from bool, or void or what is, with the open curly brackets, till the corresponding closing curly brackets, for example CheckDailyFXNews like this:
