Download MetaTrader 5

Kill signal for EAs

To add comments, please log in or register
Sell products via the Market and track your sales statistics
cryptex23
268
cryptex23 2016.11.13 15:56 

Hi Folks,

Last week a position went somewhat wrong and I wanted to stop my EA, but as my EA sits on a VPN, I was not able to stop it. Can someone advise me if there is a way to send an email kill message to EAs?

Thanks,
 

Carl Schreiber
6592
Carl Schreiber 2016.11.13 21:19  
cryptex23:

Hi Folks,

Last week a position went somewhat wrong and I wanted to stop my EA, but as my EA sits on a VPN, I was not able to stop it. Can someone advise me if there is a way to send an email kill message to EAs?

Thanks,
 

You can tell your EA to kill itself:

   if (..) ExpertRemove();
cryptex23
268
cryptex23 2016.11.14 16:35  
Carl Schreiber:

You can tell your EA to kill itself:

   if (..) ExpertRemove();
Thanks for your response. Could you please elaborate a little more on how do I incorporate an email trigger into my if condition? My VPN is not always directly accessible.
Marco vd Heijden
Moderator
4704
Marco vd Heijden 2016.11.14 16:46  

You can code your EA in a way that it will detect any change that was not made by the EA itself.

For example: you can use your phone and the mobile terminal to open or close an order.

Then you can have your EA listen for these external changes,

And upon detecting that you manually opened or closed an order have the ea switch itself off, or simply have the EA stop opening new orders, or have the EA trail all other open positions.

You can make it do a lot of things that way simply by synchronizing the number of orders that the EA opened with the number of actual open orders, any change can be detected and used as an interrupt or trigger to set off some action or interrupt routine.

It's fast and safe as compared to the complex Email stuff you had in mind.
Carl Schreiber
6592
Carl Schreiber 2016.11.14 18:18  
cryptex23:
Thanks for your response. Could you please elaborate a little more on how do I incorporate an email trigger into my if condition? My VPN is not always directly accessible.

mt4 know 2 ways to inform you: SendMail(..) and SendNotification(..)

So if you know the 'crash-condition' you need just:

if (abort_now == true) {

   SendMail("subj.","txt");

   SendNotification("text")

   ExpertRemove();

}

But you have to set and enable it in the terminal first: Tools => Options (Ctrl-o) => tabs of Notification and/or Email.


cryptex23
268
cryptex23 2016.11.14 18:38  
Marco vd Heijden:

You can code your EA in a way that it will detect any change that was not made by the EA itself.

For example: you can use your phone and the mobile terminal to open or close an order.

Then you can have your EA listen for these external changes,

And upon detecting that you manually opened or closed an order have the ea switch itself off, or simply have the EA stop opening new orders, or have the EA trail all other open positions.

You can make it do a lot of things that way simply by synchronizing the number of orders that the EA opened with the number of actual open orders, any change can be detected and used as an interrupt or trigger to set off some action or interrupt routine.

It's fast and safe as compared to the complex Email stuff you had in mind.
Thanks, this makes sense. I will put a limit order far away, count the presence of any such number and then kill the program.
To add comments, please log in or register