Disliked{quote} Alrightie then, I finally am coming a little bit closer to where I want to be. This is the new code I have used //---- Close Open BUY and Pending BUY by Selected Symbols and Selected Profit of Open BUYS { double orderTP = OrderTakeProfit(); int Btotal2=OrdersTotal(); for(int iii=Btotal2-1; iii>=0; iii--) { if(OrderSelect(iii,SELECT_BY_POS,MODE_TRADES)==true) { if(OrderSymbol()==_Symbol&& OrderClosePrice()==orderTP) { if(OrderType()==OP_BUY ) { bool resultbuy = OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),3,Red); } if(OrderType()==OP_BUYSTOP)...Ignored
not sure if this will work for you as i don't know what else your code does, but if you simply want to close all open and pending orders when one hits a TP, then why not base your logic on a count of the open/pending orders.
keep looping and look for a time when the order count decreases (assume its a result of one TP hit) and close everything that is currently still open
" check out The Traders Outpost "