Download MetaTrader 5
To add comments, please log in or register
Thousands of developers have already published their products in the Market. Join them!
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