OpenOrders for only one CurrencyPair

 

Hello,


im trying to find out a way to use OrdersTotal() forjust one security symbol, while im running the EA for more than one. Can you help me pls?



regards, IceRage

 

Create a counter variable and set it to 0.

Create a loop to count down through all of the orders. The loop will execute OrderTotal() number of times.

Select each order and check whether the return of Symbol() matches the symbol you're interested. If it does, then add one to your counter variable.

There are plenty of examples in the forum if you take some time to look.

CB

 

maybe it could be like this:


bool symbolOrdered(string symbolToOrder)
   {
      for(int i = 0; i < OrdersTotal(); i++){      
         if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES)){
            if(symbolToOrder == OrderSymbol()){
               return (true);
            } else {
               continue;
            }          
         } else {            
            return (false);
         }
      } 
      
      return (false);          
   }
Reason: