When next bar open with gap ? How to cancel pending order ?

 

Open pending order by Buy Stop.

If next bar open price with gap jump over buy stop level more than 10 pips.

How to delete pending order before change position from buy stop to buy order ?


thank you

 

if the gap makes the price jump over your buy stop level you can't delete it any more (OrderDelete) because the order has already triggered

you can close it (OrderClose) if you want

 

If it gaps up over your trigger it's already too late to delete it.

Don't use buystops in EAs. Those are for Humans that can't watch every tick of the day.

Have the EA check for price at or above your trigger price and less than your trigger + max slippage. Open an order. If it's above max, you've missed it.
 
thank you