Download MetaTrader 5

Is orderstotal() for the current symbol, or for all symbols?

To add comments, please log in or register
Join MQL5 Cloud Network. Start earning money!
Luciano Ola
1007
Luciano Ola 2014.03.31 23:56 
If it is for all symbols is there a function that returns the total orders open for the current symbol?
Luciano Ola
1007
Luciano Ola 2014.03.31 23:57  

Nvm I have found the function. 

 

SymbolInfoInteger(Symbol(),SYMBOL_SESSION_DEALS); 

 If anyone else is wondering.

Rodrigo Malacarne
Moderator
9904
Rodrigo Malacarne 2014.04.01 03:18  
MetaNt:

Nvm I have found the function. 

 

 If anyone else is wondering.

OrdersTotal( ) returns the total number of pending orders for all symbols.

If you want to individualize the amount of pending orders for the current symbol, you might use:

for(int i=0;i<OrdersTotal();i++)
  {
   if(OrderSelect(OrderGetTicket(i)) && OrderGetString(ORDER_SYMBOL)==_Symbol)
     {
      // Your logic here
     }
  }

If you want to retrieve the number of pending orders for another symbol, you can substitute _Symbol by the desired symbol name, for instance:

OrderGetString(ORDER_SYMBOL)=="AUDCAD"

I hope it helps you somehow.
Malacarne 

To add comments, please log in or register