//+------------------------------------------------------------------+
//|                      Virtual Pips Equity                         |
//+------------------------------------------------------------------+
#property link      ""
#property version   "1.00"
#property strict


#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 DodgerBlue   //Equity color
#property indicator_color2 Red   //MA color

//--- input parameters
extern int                   MA_Period  = 50;
extern ENUM_MA_METHOD        MA_Method = 0;
extern int                   MA_Shift =0;

//---

int    Equity;

//--- buffers
double EQ[];
double MA[];

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorShortName("VirtualPipsEquity with MA("+IntegerToString(MA_Period,0,' ')+")");
   IndicatorBuffers(2);

//---- drawing settings of EQ
   SetIndexBuffer(0,EQ);
   SetIndexLabel(0,"EQ");
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);

//---- drawing settings of Moving Average
   SetIndexBuffer(1,MA);
   SetIndexLabel(1,"MA of EQ");
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);

//--

   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int start()
  {
  
   Equity = GlobalVariableGet("GV_vEq");
  
   int counted_bars=IndicatorCounted();
   int limit = Bars-counted_bars-1;

   for(int i=limit; i>=0; i--)
     {
      EQ[i] = Equity;
     }
   for(int i=limit; i>=0; i--)
     {
      MA[i] = iMAOnArray(EQ,0, MA_Period,MA_Shift,MA_Method,i);
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
  {
//----

//----
   return(0);
  }
//+------------------------------------------------------------------+
