how to close all orders in build 600?
It didn't work before build 600 either.
----------------------------------------------------------------------------------- void closeall() { int total=OrdersTotal(); Print("Close ALLLLLLLLLLLLLLLLLLLL"); for(int i=total-1;i>=0;i--) { if(!OrderSelect(i,SELECT_BY_POS)) continue; { if(OrderMagicNumber()==magicnum) { if(!OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),5,White)) Print("OrderClose error ",GetLastError()); return; } } } }
The return means that the loop is stopped after the first run
-
Play videoPlease edit your post.
For large amounts of code, attach it.
- My old ea is not worked"Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
- There isn't anything wrong with that code. Ignoring occasional error if market is close to any TP/SL set. MarketInfo(_Symbol, MODE_STOPLEVEL) * Point
WHRoeder:
-
Play videoPlease edit your post.
For large amounts of code, attach it.
- My old ea is not worked"Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
- There isn't anything wrong with that code. Ignoring occasional error if market is close to any TP/SL set. MarketInfo(_Symbol, MODE_STOPLEVEL) * Point
Sorry for my bad english...
i just don't know how to write a close all orders function,
could you teach me? thanks
void closeall(){ Print("Close ALLLLLLLLLLLLLLLLLLLL"); for(int total=OrdersTotal(); total > 0;){ --total; if(OrderSelect(total,SELECT_BY_POS) && OrderMagicNumber()==magicnum){ if(!OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),5,White)) Print("OrderClose error ",GetLastError()); } }
Hello,
My old ea is not worked when i update to build 600.
This is how i write. it only can close the last order.
could you tell me what's the problem?
thanks.
-----------------------------------------------------------------------------------
void closeall()
{
int total=OrdersTotal();
Print("Close ALLLLLLLLLLLLLLLLLLLL");
for(int i=total-1;i>=0;i--)
{
if(!OrderSelect(i,SELECT_BY_POS)) continue;
{
if(OrderMagicNumber()==magicnum)
{
if(!OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),5,White))
Print("OrderClose error ",GetLastError());
return;
}
}
}
}