#property indicator_chart_window

#property indicator_buffers 3

#property indicator_color1 DeepPink
#property indicator_color2 DodgerBlue
#property indicator_color3 Blue

#property indicator_width1 1
#property indicator_width2 2
#property indicator_width3 2

//---- extern inputs -------------------------------------------------
extern string ____Average___ = "0=SMA,1=EMA,2=SMMA,3=LWMA";
extern int ma_method_10 = MODE_EMA;
extern int ma_method_35 = MODE_SMA;
extern int ma_method_50 = MODE_EMA;
extern string ____Price___ = "0=Close,4=Median,5=Typical";
extern int applied_price = PRICE_CLOSE;
extern int Period10 = 10;
extern int Period35 = 35;
extern int Period50 = 50;
//--------------------------------------------------------------------

//---- buffers
double avg10[], avg35[], avg50[];

//---- constants
#define IND_NAME ""
//---- variables

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{  
   //---- indicators
   SetIndexBuffer(0,avg10); SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(1,avg35); SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(2,avg50); SetIndexStyle(2,DRAW_LINE);
      
   SetIndexLabel(0,"MAvg_" + Period10);
   SetIndexLabel(1,"MAvg_" + Period35);
   SetIndexLabel(2,"MAvg_" + Period50);

   IndicatorShortName(IND_NAME);
     
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
   return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
int i,limit;

   int counted_bars=IndicatorCounted();
   if (counted_bars < 0) return(-1);
   if (counted_bars > 0) counted_bars--;
   limit = Bars - counted_bars;
   
   for (i = limit; i >= 0; i--) 
   {     
      avg10[i] = iMA(Symbol(),Period(),Period10,0,ma_method_10,applied_price,i);
      avg35[i] = iMA(Symbol(),Period(),Period35,0,ma_method_35,applied_price,i);
      avg50[i] = iMA(Symbol(),Period(),Period50,0,ma_method_50,applied_price,i);
   }
   return(0);
}