calculate lots of all orders open - mql4/mql5

 

how I can calculate lots of all orders open?

 mql4/mql5

 

Thank you 

 
Tiago Cetto Pietralonga:

how I can calculate lots of all orders open?

 mql4/mql5

 

Thank you 

//+------------------------------------------------------------------+
//| Get Lots Total                                                   |
//+------------------------------------------------------------------+
double GetLots()
  {
   double lots_total=0;
   for(int i=0;i<OrdersTotal();i++)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
        {
         //if(OrderMagicNumber()==MagicNumber)
           {
            //if(OrderSymbol()==Symbol())
              {
               lots_total=lots_total+OrderLots();
              }
           }
        }
     }
   return(lots_total);
  }
//+------------------------------------------------------------------+
 
Marco vd Heijden:

It's working

 

Thank you 

Reason: