How to find specific order in an EA? - page 2

 
wing:

diostar,

Oh, sorry, I mixed them, it should be OP_SELL_STOP, not OP_SELL_LIMIT.

Wing


why not you simply consider to delete this order if the profit locking happens? So you will just have 2 trades per group, instead of 3. Then you can use OrderCloseBy?
 
diostar:
why not you simply consider to delete this order if the profit locking happens? So you will just have 2 trades per group, instead of 3. Then you can use OrderCloseBy?


It is because I found that if I use too many for loop in every tick, the backtest runs very slow (e.g. 30min for 2 years' historical data), so I avoid to use for loop as much as I can.

In this case, if I have to check for whether profit locking appears in the group, I have to use for loop. Also, I have to check for whether OP_SELL_STOP order is still here, I have to use another for loop.

Those actions will heavily slow down the backtest, so I will prefer closing all three orders at the same time.