What happens when you delete an EA?

 

Quick question,

What were to happen if you delete an EA that still has positions open? Would it close all the positions or do they still stay open and just no further action happens from the EA?

Thanks,

Kyle

 
Kyle Boyko :

Quick question,

What were to happen if you delete an EA that still has positions open? Would it close all the positions or do they still stay open and just no further action happens from the EA?

Thanks,

Kyle

You can register deletion of all positions and closing of all pending orders in OnDeinit.

But this does not guarantee: since there are different closings (normal and extreme), it all depends on the user's imagination.

 
Kyle Boyko:

Quick question,

What were to happen if you delete an EA that still has positions open? Would it close all the positions or do they still stay open and just no further action happens from the EA?

Thanks,

Kyle

Generally speaking, most EAs, when disabled/removed/deleted will not carry out any kind of order cancelling or position closing, and there are two main reasons for that:

  1. Because the author of the code never thought about that possibility ...
  2. ... and because if it did that improperly, than every time a chart got closed accidentally, or something similar, then you could incur losses if it just started closing everything.

So, in general, you have to monitor and manage the trades manually, when the EAs are down!

Some EA's however, have the ability to pick-up where they left off when they are restarted, and will continue to manage those trades for you again when you enable them again. But not all EAs are that intelligent!

This is also a reason why you should always have a S/L and a T/P in place, should a system go down! While the EA is "live", it should manage and change the S/L and T/P while it is in control to suit the need, but at least it will be in place should something go wrong.

 
Fernando Carreiro: Generally speaking, most EAs, when disabled/removed/deleted will not carry out any kind of order cancelling or position closing, and there are two main reasons for that:

3) The EA must exit from OnDeinit within 2.5 seconds (on MT4), or it will be forcefully be terminated. It doesn't have time to close trades.

Reason: