How to delete pending order autumatically when EA disconnected

 

I know EA can delete a pending order on a specific expiration date.

But I need another solution:

Lets say EA opens a Buy trade and also places a pending order (Buy Limit) for the same strategy.

According to the strategy the EA should delete the pending order if the Open trade reached its TP.

Suppose the mt4 platform is disconnected while there is an open trade + Limit order as described, and price reached TP.

The Open trade will be closed of course, but how can I make sure the Limit Order is deleted at the same moment, while still disconnetced?

 

I don't think that you can.

As the EA runs its start() program every incoming tick and if disconnected, there will be no incoming ticks, the EA cannot do anything.

 
Don't disconnect. Get a VPS for live trading.