Download MetaTrader 5

calculate lots of all orders open - mql4/mql5

To add comments, please log in or register
Tiago Cetto Pietralonga
509
Tiago Cetto Pietralonga 2016.07.05 19:34 

how I can calculate lots of all orders open?

 mql4/mql5

 

Thank you 

Marco vd Heijden
Moderator
4729
Marco vd Heijden 2016.07.05 20:58  
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);
  }
//+------------------------------------------------------------------+
Tiago Cetto Pietralonga
509
Tiago Cetto Pietralonga 2016.07.07 19:17  
Marco vd Heijden:

It's working

 

Thank you 

To add comments, please log in or register