//+------------------------------------------------------------------+
//|                                                          iOT.mq4 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, Morochin <artamir> Artiom."
#property link      "http://www.forexmducoz.org"

#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   int ot = OrdersTotal();
   int oht = OrdersHistoryTotal();
   
   double slot = 0;
   int t = 0;
   
   
   for(int i = 0; i <= ot; i++){
      if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue;
	  if(OrderType() >= 2) continue;
      slot = slot + OrderLots();
      t = t + 1;
   }
   
   for(i = 0; i <= oht; i++){
      if(!OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) continue;
      if(OrderType() >= 2) continue;
	  slot = slot + OrderLots();
      t = t + 1;
   }
   
   Comment("OL = "+slot+"\n",
            "OT = "+t);
//----
   return(0);
  }
//+------------------------------------------------------------------+