Need help in getting the current totalorders of buy/sell lots

 
How to get the current totalorders of buy lots and sell lots. Anyone? I need help in this.
 
int TotalBuy() 
   { 
   int count=0; 
   for (int i=0; i<OrdersTotal(); i++) 
      { 
      if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) break; 
      if (OrderSymbol()!=Symbol()) continue; 
      if (OrderType()==OP_BUY) count++; 
      } 
   return (count); 
   } 
 
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
 
int TotalSell() 
   { 
   int count=0; 
   for (int i=0; i<OrdersTotal(); i++) 
      { 
      if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) break; 
      if (OrderSymbol()!=Symbol()) continue; 
      if (OrderType()==OP_SELL) count++; 
      } 
   return (count); 
   }
 
Thanks, but tht  counts the number of buy and sell. I only want the total lots.
Im having this code but it doesnt work. It doesnt return the total lots of buy and sell. Anyone?      

      int BuyLots=0;
      int SellLots=0;
      int mode;
 
      for(cnt=0;cnt<OrdersTotal();cnt++)
      {    
        OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
         mode=OrderType();
         BuyLots=OrderLots();
         SellLots=OrderLots();
         if (OrderSymbol()==Symbol())         
         {
            if (mode==OP_BUY) { BuyLots++; }
            if (mode==OP_SELL) { SellLots++; }
         }
      }
 
Your lot count is reset to the current trade volume for every new order you count. Try this:

      int BuyLots=0;
      int SellLots=0;
      int mode;
 
      for(cnt=0;cnt<OrdersTotal();cnt++)
      {    
        OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
         mode=OrderType();
 
         if (OrderSymbol()==Symbol())         
         {
            if (mode==OP_BUY) { BuyLots += OrderLots(); }
            if (mode==OP_SELL) { SellLots += OrderLots(); }
         }
      }
 
Tht doesnt work either.
 
ejoi:
Tht doesnt work either.
OrderLots() is a double, so BuyLots and SellLots must be doubles as well. Apart from this, the logic must be ok, if I understood your intention properly.
 
Thanks... it works now :)
Reason: