//+------------------------------------------------------------------+
//|                                                  tutorial_ea.mq4 |
//|                                   Copyright © 2009, Thomas Liles |
//|                                       http://www.some_site.com   |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, Thomas Liles"
#property link      "http://www.some_site.com"
int blah;
int buys,sells;
double buy_lots,sell_lots,profit;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   if (!GlobalVariableCheck(AccountNumber()+WindowExpertName()+Symbol()+IsTesting()))
   GlobalVariableSet(AccountNumber()+WindowExpertName()+Symbol()+IsTesting(),iBarShift(NULL,0,1));
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
orders();
//----
   return(0);
  }
//+------------------------------------------------------------------+
void orders()
{
buys=0;
sells=0;
buy_lots=0;
sell_lots=0;
profit=0;
  for(int i=OrdersTotal();i>=0;i--)
 {
    OrderSelect(i, SELECT_BY_POS);
    if ( OrderType() == OP_BUY)  
        {
        buys=buys+1;
        buy_lots=buy_lots+OrderLots();
        profit=(profit+OrderProfit())+OrderSwap();
        }
    if ( OrderType() == OP_SELL )
        {
        sells=sells+1;
        sell_lots=sell_lots+OrderLots();
        profit=(profit+OrderProfit())+OrderSwap();
        }
 }
}