If one order hits TP or SL, slose the other

 

I have an EA, which sets up 1 BUY and 1 SELL order every day.

If one of the pending orders is opened and it hits either its TP or SL, I want the EA to pick this up and close any other existing pending orders.

How can I check if an order has been closed today?

 

Hi

You could monitor the totaltrades() variable and when it goes to 1 a trade is open, then wait for it to go to zero to close all pending trades.

 
Ruptor:

Hi

You could monitor the totaltrades() variable and when it goes to 1 a trade is open, then wait for it to go to zero to close all pending trades.

int OrdersTotal( )

Returns market and pending orders count.


It's only the marketorders that I'm interested in.

If market count = 0, then do nothing

if market count = 1 then delete remaining pending orders.

 

Hi

True, yes I forgot it included pending orders having already solved this problem for myself. I scan from 0 to totalorders and count the open orders of types, OP_BUY and OP_SELL, on every tick.

Reason: