ปิด order ทุกชนิดได้หมด
int start()
{
int total =OrdersTotal();
int x=0;
while (x<1) //Point 1
{
for(int i=0;i<total;i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
int type = OrderType();
bool result = false;
switch(type)
{
case OP_BUY : result = OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),3,Pink);
break;
case OP_SELL : result = OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),3,Pink);
break;
case OP_BUYLIMIT : result = OrderDelete(OrderTicket());
break;
case OP_SELLLIMIT : result = OrderDelete(OrderTicket());
break;
case OP_BUYSTOP : result = OrderDelete(OrderTicket());
break;
case OP_SELLSTOP : result = OrderDelete(OrderTicket());
break;
}
}
if(OrdersTotal()==0) //Point 2
x=1;
}
return(0);
}