close all function problem New comment [Deleted] 2011.02.15 06:26 i have an hedging and grid EA, i have a problem when closing order. let say if i have 7 sell order and 3 buy order position, when close all function running sometimes it won't close all order. so it will leave 4 orders open, 2 sell and 2 buy order position. the question is why it happened and why its not always happen ( sometimes ). any body want to help me ??? check the code below int closeall() { int tutup=0; for(int hitung=OrdersTotal()-1; hitung>=0; hitung--) { if(!OrderSelect(hitung, SELECT_BY_POS, MODE_TRADES)) break; if(OrderSymbol()!=Symbol()) continue; if(OrderMagicNumber()==123456) { if (ScanOpenTrades()>0) if(OrderType()==OP_BUY) { if(OrderClose(OrderTicket(), OrderLots(), Bid, 10, Green)) tutup++; } if(OrderType()==OP_SELL) { if(OrderClose(OrderTicket(), OrderLots(), Ask, 10, Yellow)) tutup++; } } } return(tutup); } Problem with OrderClose() Close all opening orders with EA [WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. qjol 2011.02.15 15:41 #1 if(OrderSymbol() != Symbol()) continue; William Roeder 2011.02.15 19:29 #2 for(int hitung=OrdersTotal()-1; hitung>=0; hitung--) if( OrderSelect(hitung, SELECT_BY_POS, MODE_TRADES) && OrderSymbol() == Symbol() && OrderMagicNumber()== 123456){ New comment
i have an hedging and grid EA, i have a problem when closing order.
let say if i have 7 sell order and 3 buy order position, when close all function running sometimes it won't close all order.
so it will leave 4 orders open, 2 sell and 2 buy order position. the question is why it happened and why its not always happen ( sometimes ).
any body want to help me ???
check the code below