How to make an OCO order (One Cancel Other)

 

How to make an artificial OCO order (One Cancel Other) with using pending orders?

What i mean about this i need a code how to test if one pending order is on and cancel the other.To be more specific i need it for stop orders,so:

  • Place a BUYSTOP and SELLSTOP at the same time (i have this so i dont need code for this)
  • If the BUYSTOP is triggered andturns into a BUY order then delete the SELLSTOP order
  • If the SELLSTOP order is triggered and turns into a SELL order then delete the BUYSTOP order

It would be for a hedger EA so i really appreciate if someone would help me .Thanks!

 
Do exactly what you said. If you find an open order, delete any pending order.
Reason: