#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 Yellow
#property indicator_width1 1
#property indicator_style1 2
#property indicator_color2 Red
#property indicator_width2 1
#property indicator_style2 2
#property indicator_color3 Aqua
#property indicator_width3 1
#property indicator_style3 2
#property indicator_color4 White
#property indicator_width4 1
#property indicator_style4 2
#property indicator_color5 RoyalBlue
#property indicator_width5 1
#property indicator_style5 2

//---- input parameters
extern ENUM_TIMEFRAMES   TimeFrame   = PERIOD_CURRENT;  // Time frame
extern string MA1="_____________________________";
extern int   MAPeriod1    = 5;
extern int   MAMode1      = 1;
extern int   MAPrice1     = 0;
extern color Price_color1 = Yellow;
extern string MA2="_____________________________";
extern int   MAPeriod2    = 13;
extern int   MAMode2      = 1;
extern int   MAPrice2     = 0;
extern color Price_color2 = Red;
extern string MA3="_____________________________";
extern int   MAPeriod3    = 50;
extern int   MAMode3      = 1;
extern int   MAPrice3     = 0;
extern color Price_color3 = Aqua;
extern string MA4="_____________________________";
extern int   MAPeriod4    = 200;
extern int   MAMode4      = 1;
extern int   MAPrice4     = 0;
extern color Price_color4 = White;
extern string MA5="_____________________________";
extern int   MAPeriod5    = 800;
extern int   MAMode5      = 1;
extern int   MAPrice5     = 0;
extern color Price_color5 = RoyalBlue;
extern string Price__________________="_____________________________";
extern int   Price_Size  = 1;
extern int   Shift_Price = 5;
input ENUM_LINE_STYLE Line_Style = STYLE_DOT;
input int Line_Width  = 1;

int triplemagic = 0;


//---- indicator buffers
double Buffer1[];
double Buffer2[];
double Buffer3[];
double Buffer5[];
double Buffer4[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
  
   SetIndexDrawBegin(0,MAPeriod1);
   SetIndexBuffer(0,Buffer1);
   SetIndexStyle(0,DRAW_LINE,Line_Style,Line_Width);
   SetIndexLabel(0,"");
   
   SetIndexDrawBegin(0,MAPeriod2);
   SetIndexBuffer(1,Buffer2);
   SetIndexStyle(1,DRAW_LINE,Line_Style,Line_Width);
   SetIndexLabel(1,"");
    
   SetIndexDrawBegin(0,MAPeriod3);
   SetIndexBuffer(2,Buffer3);
   SetIndexStyle(2,DRAW_LINE,Line_Style,Line_Width);
   SetIndexLabel(2,"");
   
   SetIndexDrawBegin(1,MAPeriod4);
   SetIndexBuffer(3,Buffer4);
   SetIndexStyle(3,DRAW_LINE,Line_Style,Line_Width);
   SetIndexLabel(3,"");
   
   SetIndexDrawBegin(2,MAPeriod5);
   SetIndexBuffer(4,Buffer5);
   SetIndexStyle(4,DRAW_LINE,Line_Style,Line_Width);
   SetIndexLabel(4,"");
   
   
 
   return(0);
  }
  
  int deinit()
  {
//----
  ObjectDelete("PRICE1"+triplemagic);
  ObjectDelete("PRICE2"+triplemagic);
  ObjectDelete("PRICE3"+triplemagic);
  ObjectDelete("PRICE4"+triplemagic);
  ObjectDelete("PRICE5"+triplemagic);
 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| 5 X EMA                                          |
//+------------------------------------------------------------------+
int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- main loop
   for(int i=0; i<limit; i++)
     {
     
      triplemagic = MAPeriod1+MAPeriod2+MAPeriod3+MAPeriod4+MAPeriod5;
      
      Buffer1[i]=iMA(NULL,0,MAPeriod1,0,MAMode1,MAPrice1,i);
      
      Buffer2[i]=iMA(NULL,0,MAPeriod2,0,MAMode2,MAPrice2,i);
      
      Buffer3[i]=iMA(NULL,0,MAPeriod3,0,MAMode3,MAPrice3,i);
      
      Buffer4[i]=iMA(NULL,0,MAPeriod4,0,MAMode4,MAPrice4,i);
    
      Buffer5[i]=iMA(NULL,0,MAPeriod5,0,MAMode5,MAPrice5,i);
      
      
      
          if (ObjectFind("PRICE1"+triplemagic) != 0){
          ObjectCreate("PRICE1"+triplemagic,OBJ_ARROW,0,customTime(-Shift_Price),Buffer1[0]);
          ObjectSet("PRICE1"+triplemagic,OBJPROP_ARROWCODE,6);
          ObjectSet("PRICE1"+triplemagic,OBJPROP_COLOR,Price_color1);  
          ObjectSet("PRICE1"+triplemagic,OBJPROP_WIDTH,Price_Size);  
           }   else {
          ObjectMove("PRICE1"+triplemagic,0,customTime(-Shift_Price),Buffer1[0]);
          ObjectSet("PRICE1"+triplemagic,OBJPROP_COLOR,Price_color1); }  
          
          if (ObjectFind("PRICE2"+triplemagic) != 0){
          ObjectCreate("PRICE2"+triplemagic,OBJ_ARROW,0,customTime(-Shift_Price),Buffer2[0]);
          ObjectSet("PRICE2"+triplemagic,OBJPROP_ARROWCODE,6);
          ObjectSet("PRICE2"+triplemagic,OBJPROP_COLOR,Price_color2);  
          ObjectSet("PRICE2"+triplemagic,OBJPROP_WIDTH,Price_Size);  
           }   else {
          ObjectMove("PRICE2"+triplemagic,0,customTime(-Shift_Price),Buffer2[0]);
          ObjectSet("PRICE2"+triplemagic,OBJPROP_COLOR,Price_color2); }       
       
         if (ObjectFind("PRICE3"+triplemagic) != 0){
          ObjectCreate("PRICE3"+triplemagic,OBJ_ARROW,0,customTime(-Shift_Price),Buffer3[0]);
          ObjectSet("PRICE3"+triplemagic,OBJPROP_ARROWCODE,6);
          ObjectSet("PRICE3"+triplemagic,OBJPROP_COLOR,Price_color3);  
          ObjectSet("PRICE3"+triplemagic,OBJPROP_WIDTH,Price_Size);  
           }   else {
          ObjectMove("PRICE3"+triplemagic,0,customTime(-Shift_Price),Buffer3[0]);
          ObjectSet("PRICE3"+triplemagic,OBJPROP_COLOR,Price_color3); }  
          
         if (ObjectFind("PRICE4"+triplemagic) != 0){
          ObjectCreate("PRICE4"+triplemagic,OBJ_ARROW,0,customTime(-Shift_Price),Buffer4[0]);
          ObjectSet("PRICE4"+triplemagic,OBJPROP_ARROWCODE,6);
          ObjectSet("PRICE4"+triplemagic,OBJPROP_COLOR,Price_color4);  
          ObjectSet("PRICE4"+triplemagic,OBJPROP_WIDTH,Price_Size);  
           }   else {
          ObjectMove("PRICE4"+triplemagic,0,customTime(-Shift_Price),Buffer4[0]);
          ObjectSet("PRICE4"+triplemagic,OBJPROP_COLOR,Price_color4); }  
          
         if (ObjectFind("PRICE5"+triplemagic) != 0){
          ObjectCreate("PRICE5"+triplemagic,OBJ_ARROW,0,customTime(-Shift_Price),Buffer5[0]);
          ObjectSet("PRICE5"+triplemagic,OBJPROP_ARROWCODE,6);
          ObjectSet("PRICE5"+triplemagic,OBJPROP_COLOR,Price_color5);  
          ObjectSet("PRICE5"+triplemagic,OBJPROP_WIDTH,Price_Size);  
           }   else {
          ObjectMove("PRICE5"+triplemagic,0,customTime(-Shift_Price),Buffer5[0]);
          ObjectSet("PRICE5"+triplemagic,OBJPROP_COLOR,Price_color5); }  
          
          
          
        }
//---- done
   return(0);
  }
  
    
  int customTime(int a)
{
if(a<0)
return(Time[0]+Period()*60*MathAbs(a));
else return(Time[a]); 
}
//+------------------------------------------------------------------+

