Download MetaTrader 5

Limit Pair To 1 Open Order - page 2

To add comments, please log in or register
MQL5 Cloud Network is a distributed computing network. Just give it a try!
Baby Blue
20
Baby Blue 2015.03.03 17: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();
   }
}
12
To add comments, please log in or register