Kill signal for EAs

 

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,
 

 
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();
 
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.
 

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.
 
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.


 
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.
Reason: