does anyone have a close all orders routine, at a specific time i want
to close all orders both open and pending
thank you
to close all orders both open and pending
thank you
Can you close all open orders at once? 36 replies
Close all pending orders and open orders once they reach profit target 3 replies
Close all orders at a certain time ea 2 replies
script to "close open orders" and "open opposite orders" 3 replies
Need Close All Orders EA 1 reply
int total=OrdersTotal(); double price; for(int a=0;a<total;a++) { if(OrderSelect(a,SELECT_BY_POS)) { if(OrderType()==OP_BUY) { price=MarketInfo(OrderSymbol(),MODE_BID); OrderClose(OrderTicket(),OrderLots(),price,100,CLR_NONE); } else if(OrderType()==OP_SELL) { price=MarketInfo(OrderSymbol(),MODE_ASK); OrderClose(OrderTicket(),OrderLots(),price,100,CLR_NONE); } else OrderDelete(OrderTicket()); } }
int CA()//Close All
{
while(OrdersTotal()>0)
{
OrderSelect(0,SELECT_BY_POS);
if(OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),999,Red);
if(OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),999,Orange);
if(OrderType()==OP_BUYSTOP||OrderType()==OP_SELLSTOP||OrderType()==OP_BUYLIMIT||OrderType()==OP_SELLLIMIT) OrderDelete(OrderTicket());
}
return(0);
}