
#property indicator_buffers 4
#property indicator_color1 White
#property indicator_color2 White
#property indicator_color3 White
#property indicator_color4 White

#property indicator_width1 1
#property indicator_width2 1
#property indicator_width3 1
#property indicator_width4 1
extern int    period           = 50;
extern int    shift           = 0;
extern int    method           = 1;
extern int    price           = 1;
extern string    time_frames           = "set the time frames";
extern int    time_frame           = 1440;
extern int    time_frame2           = 1440;
extern int    time_frame3           = 1440;
extern int    time_frame4           = 1440;
extern int    bars_back=3000;
int counted;
static double buffer0[];
static double buffer1[];
static double buffer2[];
static double buffer3[];
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorShortName("my indy");
   SetIndexBuffer(0,buffer0);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexLabel(0,"my indy");
   
   SetIndexBuffer(1,buffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexLabel(1,"my indy");
   
   SetIndexBuffer(2,buffer2);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexLabel(2,"my indy");
   
   SetIndexBuffer(3,buffer3);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexLabel(3,"my indy");
   //----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
//----
if (bars_back>Bars)bars_back=Bars;
if (counted>0)counted--;
for(int i=bars_back-counted; i>-1; i--)
{counted++;
int bar_shift = iBarShift(NULL,time_frame,Time[i]);
int bar_shift1 = iBarShift(NULL,time_frame2,Time[i]);
int bar_shift2 = iBarShift(NULL,time_frame3,Time[i]);
int bar_shift3 = iBarShift(NULL,time_frame4,Time[i]);
buffer0[i]= iMA(NULL,time_frame,period,shift,method,price,bar_shift);
buffer1[i]= iMA(NULL,time_frame2,period,shift,method,price,bar_shift1);
buffer2[i]= iMA(NULL,time_frame3,period,shift,method,price,bar_shift2);
buffer3[i]= iMA(NULL,time_frame4,period,shift,method,price,bar_shift3);
}
//----
   return(0);
  }
//+------------------------------------------------------------------+