#property copyright "brs"
#property indicator_chart_window

enum  MA_Type
         {
            ma_adxvma,                                           // Adxvma
            ma_ahr,                                              // Ahrens moving average
            ma_alma,                                             // Arnaud Legoux Moving Average - ALMA
            ma_alxma,                                            // Alexander moving average - ALXMA
            ma_dema,                                             // Double exponential moving average - DEMA
            ma_dfema,                                            // Double fast exponential moving average - DFEMA
            ma_dsema,                                            // Double smoothed exponential moving average - DSEMA
            ma_dsema2,                                           // Double smoothed EMA (variation)
            ma_dsemaf,                                           // Double smoothed fast exponential moving average - DSFEMA
            ma_dswema,                                           // Double smoothed Wilders exponential moving average - DSWEMA
            ma_dscma,                                            // Deviation scaled MA - DSCMA
            ma_dwma,                                             // Double weighted MA - DWMA
            ma_edic,                                             // Ehlers distance coefficient filter - EDIC
            ma_emas,                                             // Ema derivative - EMAD
            ma_ema,                                              // Exponential moving average - EMA
            ma_epma,                                             // End point moving average - EPMA
            ma_emaf,                                             // Fast exponential moving average - FEMA
            ma_eotf,                                             // Ehlers Optimal tracking filter
            ma_frama,                                            // Fractal adaptive moving average - FRAMA
            ma_gchan,                                            // G Channel average - GCHAN
            ma_hull,                                             // Hull moving average - HMA
            ma_hulle,                                            // Hull moving average EMA based - HMAe
            ma_hullf,                                            // Hull moving average Fast EMA based - HMAf
            ma_hulls,                                            // Hull moving average Slow ma based - HMAs
            ma_ie2,                                              // IE/2
            ma_ilinr,                                            // Integral of linear regression slope
            ma_itl,                                              // Instantaneous trendline
            ma_jur,                                              // Jurik smoothing
            ma_lagg,                                             // Laguerre filter
            ma_lead,                                             // Leader exponential moving average
            ma_linr,                                             // Linear regression value - LSMA
            ma_slwma,                                            // Smoothed linear weighted moving average - SLWMA
            ma_lwma,                                             // Linear weighted moving average - LWMA
            ma_mcg,                                              // McGinley Dynamic
            ma_mcg2,                                             // McGinley Dynamic 2
            ma_mcma,                                             // McNicholl ema
            ma_nlma,                                             // Non lag moving average
            ma_nma,                                              // Natural moving average - NMA
            ma_pdfma,                                            // Probability density funcion ma (pdfma)
            ma_pwma,                                             // Parabolic weighted moving average - PWMA
            ma_qrma,                                             // Quadratic regression average
            ma_qwma,                                             // Quadratic weighted average
            ma_rma,                                              // Rolling moving average - RMA
            ma_rmta,                                             // Recursive moving trendline - RMTA
            ma_rwavg,                                            // Range weighted average - RWAVG
            ma_rwema,                                            // Range weighted EMA - RWEMA
            ma_rwemads,                                          // Range weighted EMA double smooth - RWDSEMA
            ma_sma,                                              // Simple moving average - SMA
            ma_sid,                                              // Simple decycler - SDEC
            ma_sine,                                             // Sine weighted moving average
            ma_smma,                                             // Smoothed moving average - SMMA
            ma_smoo,                                             // Smoother
            ma_smoo2,                                            // Smoother JMA like
            ma_ssm,                                              // Super smoother
            ma_b3p,                                              // Three pole Ehlers Butterworth
            ma_s3p,                                              // Three pole Ehlers smoother
            ma_mt3r,                                             // Fulks/Matulich T3 r adaptive - MT3R;
            ma_tt3r,                                             // Tillson T3 R adaptive
            ma_tma,                                              // Triangular moving average - TMA
            ma_tema,                                             // Triple exponential moving average - TEMA
            ma_tsema2,                                           // Triple smoothed EMA (variation)
            ma_twema,                                            // Triple wilders exponential moving average - TWEMA
            ma_b2p,                                              // Two pole Ehlers Butterworth
            ma_s2p,                                              // Two pole Ehlers smoother
            ma_vidya,                                            // Vidya
            ma_vema,                                             // Volume weighted ema - VEMA
            ma_vwma,                                             // Volume weighted moving average - VWMA
            ma_zldema,                                           // Zero lag dema
            ma_zlhulle,                                          // Zero lag Hull ema based - ZLHMAe
            ma_zlhullf,                                          // Zero lag Hull fast ema - ZLHMAf
            ma_zlhulls,                                          // Zero lag Hull slow ma - ZLHMAs
            ma_zlma,                                             // Zero lag moving average
            ma_zltema                                            // Zero lag tema
};

 extern int mm1 = 20; 
 extern int mm2 = 20;
 extern int mm3 = 20;
 extern int mm4 = 20;
 extern int mm5 = 20;
 extern int tfm1 = 15;
 extern int tfm2 = 30;
 extern int tfm3 = 60;
 extern int tfm4 = 240;
 extern int tfm5 = 1440;
 
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Blue
#property indicator_color2 Green
#property indicator_color3 Red
#property indicator_color4 Yellow
#property indicator_color5 Magenta
#property indicator_width1  2
#property indicator_width2  2
#property indicator_width3  2
#property indicator_width4  2
#property indicator_width5  2
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];


int init()
  {
   SetIndexStyle(0,DRAW_LINE,EMPTY,2);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE,EMPTY,2);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_LINE,EMPTY,2);  
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(3,DRAW_LINE,EMPTY,2);
   SetIndexBuffer(3,ExtMapBuffer4);
   SetIndexStyle(4,DRAW_LINE,EMPTY,2);  
   SetIndexBuffer(4,ExtMapBuffer5);
   return(0);
  }

int deinit()
  {
   return(0);
  }

int start()
  {
   int i,limit,counted_bars=IndicatorCounted();
      
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   
   for(i=0; i<limit; i++){
      ExtMapBuffer1[i]=iMA(NULL,tfm1,mm1,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer2[i]=iMA(NULL,tfm2,mm2,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer3[i]=iMA(NULL,tfm3,mm3,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer4[i]=iMA(NULL,tfm4,mm4,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer5[i]=iMA(NULL,tfm5,mm5,0,MODE_EMA,PRICE_CLOSE,i);

   }
   
   return(0);
  }
