//+------------------------------------------------------------------+
//|                               Copyright © 2011, Хлыстов Владимир |
//|                                                cmillion@narod.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, http://cmillion.narod.ru"
#property link      "cmillion@narod.ru"
//----
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 LightSeaGreen
//#property indicator_color2 DarkTurquoise
//#property indicator_color3 OrangeRed
#property indicator_style1 0
//#property indicator_style2 0
//#property indicator_style3 0

//double BalanceBuffer[];
double EquityBuffer[];
//double FreeMarginBuffer[];

int BatTime;
//+------------------------------------------------------------------+
int init()
{
   IndicatorBuffers(1);
   //SetIndexBuffer(0, BalanceBuffer);
   SetIndexBuffer(0, EquityBuffer);
   //SetIndexBuffer(2, FreeMarginBuffer);

   //SetIndexLabel(0, "Balance");
   SetIndexLabel(0, "Equity");
   IndicatorDigits(2);
   //SetIndexLabel(2, "FreeMargin");
   return(0);
}
//+------------------------------------------------------------------+
int start()
{
   //BalanceBuffer[0]   =AccountBalance();
   EquityBuffer[0] = AccountEquity()-AccountBalance();
   //FreeMarginBuffer[0]=AccountFreeMargin();
   
   if (BatTime==Time[0]) return;
   BatTime=Time[0];
   
   for(int i = Bars-1; i > 0; i--)
   {
      //BalanceBuffer[i]    = BalanceBuffer[i-1];
      EquityBuffer[i]     = EquityBuffer[i-1];
      //FreeMarginBuffer[i] = FreeMarginBuffer[i-1];
   }
   
   return(0);
  }
//+------------------------------------------------------------------+