
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Magenta
#property indicator_color2 Aqua
#property indicator_width1 2
#property indicator_width2 2
//----
extern string MA1= " Moving Average 1";
extern int Period_1=50;
input ENUM_MA_METHOD Method1=2;
extern int Shift1=0;
input ENUM_APPLIED_PRICE Price1=3;
extern string MA2= " Moving Average 2";
extern int Period_2=50;
input ENUM_MA_METHOD Method2=2;
extern int Shift2=0;
input ENUM_APPLIED_PRICE Price2=2;
//----
double ma1[];
double ma2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE,0);
   SetIndexBuffer(0,ma1);
   
   SetIndexStyle(1,DRAW_LINE,0);
   SetIndexBuffer(1,ma2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
//---- 
   int limit;
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) counted_bars=0;
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;

//---- 
   for(int i=0 ;i < limit ;i++)
     {
      ma1[i]=iMA(NULL,0,Period_1,Shift1,Method1,Price1,i);
      ma2[i]=iMA(NULL,0,Period_2,Shift2,Method2,Price2,i);
     }
     
//----
   return(0);
  }
//+------------------------------------------------------------------+