Limit Pair To 1 Open Order

Back to topics list  | 1 2 To post a new topic, please log in or register
avatar
10
barando 2015.03.03 18:50 #
 

Try this:

 

void IfOrderDoesNotExistBuy(){
   bool exists = false;
   for (int i=OrdersTotal(); i >= 0; i--){
     
      if (OrderSelect(i, SELECT_BY_POS)==1 && OrderSymbol()==Symbol()){
         exists = true;
      }else{
         Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
      }
   }

   if(exists == false){
      BuyOrderType();
   }
}
Back to topics list   | 1 2  

To add comments, please log in or register