Auto closing a pending order

 

Hi,

I have 2 pending orders, a buy_stop in price a, and a sell_stop in price b. I want each one of pending orders automatically closes when another one executes. I mean buy_stop pending order closes automatically when sell_stop pending order executes, and vice versa.

how can I do it in mq4?

Thanks in advance

Hadi

 

suggestion.

when pendingorders == 2 : do nothing

when pendingorders == 1 : delete order.

Reason: