activated pending order is closed with other orders in closeallorders method

 

Hi,

In my strategy by the activation of a pending order, other orders should be closed, unfortunately a problem occurred here which is the activated pending order is closed too.

i would like this doesn't happen.

would u please help me?

best regards,

 
Ali_Moradi:

Hi,

In my strategy by the activation of a pending order, other orders should be closed, unfortunately a problem occurred here which is the activated pending order is closed too.

i would like this doesn't happen.

would u please help me?

Don't close the order that activated the event . . .  if you want more specific help show your code where you have tried and failed to do what you want,  explaining what it didn't do that it should have.
 
Ali_Moradi: the activation of a pending order, other orders should be closed, unfortunately a problem occurred here which is the activated pending order is closed too.
There is no such thing as a "activated pending order." Once it is open, it is no longer pending.
  1. Find the most recent orderOpenTime with a orderSelect loop. Perhaps using GetSortedOrders - Order History sort by closing date - MQL4 forum
  2. Close all tickets, EXCEPT the latest one.
Also remember, hedging is forbidden in the US. If you're here and the open direction is opposite the pending direction, its not going to work (except in the tester.)
Reason: