Close_all_Op

Close_all_Op
Orders Execution
Checks for the total of open ordersIt Closes Orders by itself
1 Views
0 Downloads
0 Favorites
Close_all_Op
int start()
  {
   int total_order;
   total_order=OrdersTotal();
   for(int cnt=total_order;cnt>=0;cnt--)
     { 
         if(OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)==true) 
            {
               if(OrderType()==OP_BUY || OrderType()==OP_BUYSTOP || OrderType()==OP_BUYLIMIT)   OrderClose(OrderTicket(),OrderLots(),Bid,3,Blue);
               if(OrderType()==OP_SELL || OrderType()==OP_SELLSTOP || OrderType()==OP_SELLSTOP) OrderClose(OrderTicket(),OrderLots(),Ask,3,Blue);
            }                       
     }
   }
   

Comments