//+------------------------------------------------------------------+ 
//|  _TRO_MA_MULTI_4                                                 | 
//|                                                                  | 
//|   Copyright © 2008, Avery T. Horton, Jr. aka TheRumpledOne       |
//|                                                                  |
//|   PO BOX 43575, TUCSON, AZ 85733                                 |
//|                                                                  |
//|   GIFT AND DONATIONS ACCEPTED                                    | 
//|                                                                  |
//|   therumpledone@gmail.com                                        |  
//+------------------------------------------------------------------+ 
// I used code from FERRUXX and Robert Hill - Thanks for sharing!
//+------------------------------------------------------------------+ 

#property copyright "Avery T. Horton, Jr. aka TheRumpledOne" 

#property link      "" 

#property indicator_chart_window 

//---- input parameters 

//extern string myPair = "" ;
extern int myxstart=130 ;
extern int myystart=11  ;


// indicators parameters
extern string    Shift_Settings_test_only        = "=== Format: 2007.05.07 00:00 ===";
extern datetime  look_time_shift       = D'2007.05.07 00:00';  // Shift for test if "test" is true
extern double    shift_indicators      =                   0;  // Shift for indicators if "test" is false
extern bool      test                  =               false;

string    MA_Settings           = "=== Moving Average Settings ===";
extern int       ExtraMAPeriod         =          5;  // Extra Moving Average period
extern int       FastMAPeriod          =          20;  // Fast Moving Average period
extern int       MediumMAPeriod        =          50;  // Medium Moving Average period
extern int       SlowMAPeriod          =          200;  // Slow Moving Average period


extern int       MAMethod              =     MODE_EMA;  // Moving Average method
extern int       MAPrice               =  PRICE_CLOSE;  // Moving Average price


double UP_1, UP_2, UP_3, UP_4, UP_5, UP_6, UP_7, UP_8, UP_9, UP_10;
double UP_11, UP_12, UP_13, UP_14, UP_15, UP_16, UP_17, UP_18, UP_19, UP_20;
double UP_21, UP_22, UP_23, UP_24, UP_25, UP_26, UP_27, UP_28, UP_29, UP_30;
double UP_31, UP_32, UP_33, UP_34, UP_35, UP_36, UP_37, UP_38, UP_39, UP_40;
double UP_41, UP_42, UP_43, UP_44, UP_45, UP_46, UP_47, UP_48, UP_49, UP_50;
double UP_51, UP_52, UP_53, UP_54, UP_55, UP_56, UP_57, UP_58, UP_59, UP_60;
double UP_61, UP_62, UP_63, UP_64;

 
 
 double UP_X1, UP_X2, UP_X3, UP_X4, UP_X5, UP_X6, UP_X7, UP_X8, UP_X9, UP_X10;
 
 double DOWN_X1, DOWN_X2, DOWN_X3, DOWN_X4, DOWN_X5, DOWN_X6, DOWN_X7, DOWN_X8, DOWN_X9, DOWN_X10;

double DOWN_1, DOWN_2, DOWN_3, DOWN_4, DOWN_5, DOWN_6, DOWN_7, DOWN_8, DOWN_9, DOWN_10;
double DOWN_11, DOWN_12, DOWN_13, DOWN_14, DOWN_15, DOWN_16, DOWN_17, DOWN_18, DOWN_19, DOWN_20;
double DOWN_21, DOWN_22, DOWN_23, DOWN_24, DOWN_25, DOWN_26, DOWN_27, DOWN_28, DOWN_29, DOWN_30;
double DOWN_31, DOWN_32, DOWN_33, DOWN_34, DOWN_35, DOWN_36, DOWN_37, DOWN_38, DOWN_39, DOWN_40;
double DOWN_41, DOWN_42, DOWN_43, DOWN_44, DOWN_45, DOWN_46, DOWN_47, DOWN_48, DOWN_49, DOWN_50;
double DOWN_51, DOWN_52, DOWN_53, DOWN_54, DOWN_55, DOWN_56, DOWN_57, DOWN_58, DOWN_59, DOWN_60;
double DOWN_61, DOWN_62, DOWN_63, DOWN_64;

double v0 =  0.764 ;
double v1 =  0.618 ;
double v2 =  0.5 ;
double v3 =  0.382 ;
double v4 =  0.236 ;
double v5 =  0.0 ;

 int myPeriod1  = 1 ;
 int myPeriod2  = 5 ;
 int myPeriod3  = 15 ;
 int myPeriod4  = 30 ;
 int myPeriod5  = 60 ;
 int myPeriod6  = 240 ;
 int myPeriod7  = 1440 ;
//+------------------------------------------------------------------+ 
//| Custom indicator initialization function                         | 
//+------------------------------------------------------------------+ 
int init() 
  { 
  
     initGraph();
  
//---- 
   return(0); 
  } 
//+------------------------------------------------------------------+ 
//| Custom indicator deinitialization function                       | 
//+------------------------------------------------------------------+ 
int deinit() 
  { 
//---- 
      deleteObject();    
//---- 
   return(0); 
  } 
//+------------------------------------------------------------------+ 
//| Custom indicator iteration function                              | 
//+------------------------------------------------------------------+ 
string Period2Text(int TmPeriod)
{
  switch (TmPeriod)
  {
    case PERIOD_M1  : return("M1");
    case PERIOD_M5  : return("M5");
    case PERIOD_M15 : return("M15");
    case PERIOD_M30 : return("M30");
    case PERIOD_H1  : return("H1");
    case PERIOD_H4  : return("H4");
    case PERIOD_D1  : return("D1");
    case PERIOD_W1  : return("W1");
    case PERIOD_MN1 : return("MN1");
  }      
  return ("ERR");
}

 

int start() 
  { 

// Shift calculation for indicators (tests only)

   double shift_1, shift_5, shift_15, shift_30, shift_60, shift_240, shift_1440, shift_10080;
   
   if( test == true )
   {
    shift_1=iBarShift(NULL,PERIOD_M1,look_time_shift,false);
    shift_5=iBarShift(NULL,PERIOD_M5,look_time_shift,false);
    shift_15=iBarShift(NULL,PERIOD_M15,look_time_shift,false);
    shift_30=iBarShift(NULL,PERIOD_M30,look_time_shift,false);
    shift_60=iBarShift(NULL,PERIOD_H1,look_time_shift,false);
    shift_240=iBarShift(NULL,PERIOD_H4,look_time_shift,false);
    shift_1440=iBarShift(NULL,PERIOD_D1,look_time_shift,false);
    shift_10080=iBarShift(NULL,PERIOD_W1,look_time_shift,false);
   }
   else
   {
    shift_1=shift_indicators;
    shift_5=shift_indicators;
    shift_15=shift_indicators;
    shift_30=shift_indicators;
    shift_60=shift_indicators;
    shift_240=shift_indicators;
    shift_1440=shift_indicators;
    shift_10080=shift_indicators;
  }
   
// Indicator (Moving Average)

   color color_ind = PowderBlue;
   
   string MAExtra_Trend_1, MAExtra_Trend_5, MAExtra_Trend_15, MAExtra_Trend_30, MAExtra_Trend_60, MAExtra_Trend_240, MAExtra_Trend_1440, MAExtra_Trend_10080;
    
   string MAfast_Trend_1, MAfast_Trend_5, MAfast_Trend_15, MAfast_Trend_30, MAfast_Trend_60, MAfast_Trend_240, MAfast_Trend_1440, MAfast_Trend_10080;
   string MAmedium_Trend_1, MAmedium_Trend_5, MAmedium_Trend_15, MAmedium_Trend_30, MAmedium_Trend_60, MAmedium_Trend_240, MAmedium_Trend_1440, MAmedium_Trend_10080;
   string MAslow_Trend_1, MAslow_Trend_5, MAslow_Trend_15, MAslow_Trend_30, MAslow_Trend_60, MAslow_Trend_240, MAslow_Trend_1440, MAslow_Trend_10080;
   double x;
   color color_indic;

     
   // Extra
   

   double ExtraMA_1_1 = iMA(NULL,PERIOD_M1,ExtraMAPeriod,0,MAMethod,MAPrice,shift_1);
   double ExtraMA_2_1 = iMA(NULL,PERIOD_M1,ExtraMAPeriod,0,MAMethod,MAPrice,shift_1+1);
   
   if ((ExtraMA_1_1 > ExtraMA_2_1)) { MAExtra_Trend_1 = "UP"; x = 116; color_indic = Lime; UP_X1 = 1; DOWN_X1 = 0; }
   if ((ExtraMA_1_1 < ExtraMA_2_1)) { MAExtra_Trend_1 = "DOWN"; x = 106; color_indic = Red; UP_X1 = 0; DOWN_X1 = 1; }

   
   double ExtraMA_1_5 = iMA(NULL,PERIOD_M5,ExtraMAPeriod,0,MAMethod,MAPrice,shift_5);
   double ExtraMA_2_5 = iMA(NULL,PERIOD_M5,ExtraMAPeriod,0,MAMethod,MAPrice,shift_5+1);
   
   if ((ExtraMA_1_5 > ExtraMA_2_5)) { MAExtra_Trend_5 = "UP"; x = 116; color_indic = Lime; UP_X2 = 1; DOWN_X2 = 0; }
   if ((ExtraMA_1_5 < ExtraMA_2_5)) { MAExtra_Trend_5 = "DOWN"; x = 106; color_indic = Red; UP_X2 = 0; DOWN_X2 = 1; }

   
   double ExtraMA_1_15 = iMA(NULL,PERIOD_M15,ExtraMAPeriod,0,MAMethod,MAPrice,shift_15);
   double ExtraMA_2_15 = iMA(NULL,PERIOD_M15,ExtraMAPeriod,0,MAMethod,MAPrice,shift_15+1);
   
   if ((ExtraMA_1_15 > ExtraMA_2_15)) { MAExtra_Trend_15 = "UP"; x = 116; color_indic = Lime; UP_X3 = 1; DOWN_X3 = 0; }
   if ((ExtraMA_1_15 < ExtraMA_2_15)) { MAExtra_Trend_15 = "DOWN"; x = 106; color_indic = Red; UP_X3 = 0; DOWN_X3 = 1; }

   
   double ExtraMA_1_30 = iMA(NULL,PERIOD_M30,ExtraMAPeriod,0,MAMethod,MAPrice,shift_30);
   double ExtraMA_2_30 = iMA(NULL,PERIOD_M30,ExtraMAPeriod,0,MAMethod,MAPrice,shift_30+1);
   
   if ((ExtraMA_1_30 > ExtraMA_2_30)) { MAExtra_Trend_30 = "UP"; x = 116; color_indic = Lime; UP_X4 = 1; DOWN_X4 = 0; }
   if ((ExtraMA_1_30 < ExtraMA_2_30)) { MAExtra_Trend_30 = "DOWN"; x = 106; color_indic = Red; UP_X4 = 0; DOWN_X4 = 1; }

   
   double ExtraMA_1_60 = iMA(NULL,PERIOD_H1,ExtraMAPeriod,0,MAMethod,MAPrice,shift_60);
   double ExtraMA_2_60 = iMA(NULL,PERIOD_H1,ExtraMAPeriod,0,MAMethod,MAPrice,shift_60+1);
   
   if ((ExtraMA_1_60 > ExtraMA_2_60)) { MAExtra_Trend_60 = "UP"; x = 116; color_indic = Lime; UP_X5 = 1; DOWN_X5 = 0; }
   if ((ExtraMA_1_60 < ExtraMA_2_60)) { MAExtra_Trend_60 = "DOWN"; x = 106; color_indic = Red; UP_X5 = 0; DOWN_X5 = 1; }

   
   double ExtraMA_1_240 = iMA(NULL,PERIOD_H4,ExtraMAPeriod,0,MAMethod,MAPrice,shift_240);
   double ExtraMA_2_240 = iMA(NULL,PERIOD_H4,ExtraMAPeriod,0,MAMethod,MAPrice,shift_240+1);
   
   if ((ExtraMA_1_240 > ExtraMA_2_240)) { MAExtra_Trend_240 = "UP"; x = 116; color_indic = Lime; UP_X6 = 1; DOWN_X6 = 0; }
   if ((ExtraMA_1_240 < ExtraMA_2_240)) { MAExtra_Trend_240 = "DOWN"; x = 106; color_indic = Red; UP_X6 = 0; DOWN_X6 = 1; }

   
   double ExtraMA_1_1440 = iMA(NULL,PERIOD_D1,ExtraMAPeriod,0,MAMethod,MAPrice,shift_1440);
   double ExtraMA_2_1440 = iMA(NULL,PERIOD_D1,ExtraMAPeriod,0,MAMethod,MAPrice,shift_1440+1);
   
   if ((ExtraMA_1_1440 > ExtraMA_2_1440)) { MAExtra_Trend_1440 = "UP"; x = 116; color_indic = Lime; UP_X7 = 1; DOWN_X7 = 0; }
   if ((ExtraMA_1_1440 < ExtraMA_2_1440)) { MAExtra_Trend_1440 = "DOWN"; x = 106; color_indic = Red; UP_X7 = 0; DOWN_X7 = 1; }

   
   double ExtraMA_1_10080 = iMA(NULL,PERIOD_W1,ExtraMAPeriod,0,MAMethod,MAPrice,shift_10080);
   double ExtraMA_2_10080 = iMA(NULL,PERIOD_W1,ExtraMAPeriod,0,MAMethod,MAPrice,shift_10080+1);
   
   if ((ExtraMA_1_10080 > ExtraMA_2_10080)) { MAExtra_Trend_10080 = "UP"; x = 116; color_indic = Lime; UP_X8 = 1; DOWN_X8 = 0; }
   if ((ExtraMA_1_10080 < ExtraMA_2_10080)) { MAExtra_Trend_10080 = "DOWN"; x = 106; color_indic = Red; UP_X8 = 0; DOWN_X8 = 1; }
  
   // FAST
   

   

   double FastMA_1_1 = iMA(NULL,PERIOD_M1,FastMAPeriod,0,MAMethod,MAPrice,shift_1);
   double FastMA_2_1 = iMA(NULL,PERIOD_M1,FastMAPeriod,0,MAMethod,MAPrice,shift_1+1);
   
   if ((FastMA_1_1 > FastMA_2_1)) { MAfast_Trend_1 = "UP"; x = 216; color_indic = Lime; UP_1 = 1; DOWN_1 = 0; }
   if ((FastMA_1_1 < FastMA_2_1)) { MAfast_Trend_1 = "DOWN"; x = 206; color_indic = Red; UP_1 = 0; DOWN_1 = 1; }

   
   double FastMA_1_5 = iMA(NULL,PERIOD_M5,FastMAPeriod,0,MAMethod,MAPrice,shift_5);
   double FastMA_2_5 = iMA(NULL,PERIOD_M5,FastMAPeriod,0,MAMethod,MAPrice,shift_5+1);
   
   if ((FastMA_1_5 > FastMA_2_5)) { MAfast_Trend_5 = "UP"; x = 216; color_indic = Lime; UP_2 = 1; DOWN_2 = 0; }
   if ((FastMA_1_5 < FastMA_2_5)) { MAfast_Trend_5 = "DOWN"; x = 206; color_indic = Red; UP_2 = 0; DOWN_2 = 1; }

   
   double FastMA_1_15 = iMA(NULL,PERIOD_M15,FastMAPeriod,0,MAMethod,MAPrice,shift_15);
   double FastMA_2_15 = iMA(NULL,PERIOD_M15,FastMAPeriod,0,MAMethod,MAPrice,shift_15+1);
   
   if ((FastMA_1_15 > FastMA_2_15)) { MAfast_Trend_15 = "UP"; x = 216; color_indic = Lime; UP_3 = 1; DOWN_3 = 0; }
   if ((FastMA_1_15 < FastMA_2_15)) { MAfast_Trend_15 = "DOWN"; x = 206; color_indic = Red; UP_3 = 0; DOWN_3 = 1; }

   
   double FastMA_1_30 = iMA(NULL,PERIOD_M30,FastMAPeriod,0,MAMethod,MAPrice,shift_30);
   double FastMA_2_30 = iMA(NULL,PERIOD_M30,FastMAPeriod,0,MAMethod,MAPrice,shift_30+1);
   
   if ((FastMA_1_30 > FastMA_2_30)) { MAfast_Trend_30 = "UP"; x = 216; color_indic = Lime; UP_4 = 1; DOWN_4 = 0; }
   if ((FastMA_1_30 < FastMA_2_30)) { MAfast_Trend_30 = "DOWN"; x = 206; color_indic = Red; UP_4 = 0; DOWN_4 = 1; }

   
   double FastMA_1_60 = iMA(NULL,PERIOD_H1,FastMAPeriod,0,MAMethod,MAPrice,shift_60);
   double FastMA_2_60 = iMA(NULL,PERIOD_H1,FastMAPeriod,0,MAMethod,MAPrice,shift_60+1);
   
   if ((FastMA_1_60 > FastMA_2_60)) { MAfast_Trend_60 = "UP"; x = 216; color_indic = Lime; UP_5 = 1; DOWN_5 = 0; }
   if ((FastMA_1_60 < FastMA_2_60)) { MAfast_Trend_60 = "DOWN"; x = 206; color_indic = Red; UP_5 = 0; DOWN_5 = 1; }

   
   double FastMA_1_240 = iMA(NULL,PERIOD_H4,FastMAPeriod,0,MAMethod,MAPrice,shift_240);
   double FastMA_2_240 = iMA(NULL,PERIOD_H4,FastMAPeriod,0,MAMethod,MAPrice,shift_240+1);
   
   if ((FastMA_1_240 > FastMA_2_240)) { MAfast_Trend_240 = "UP"; x = 216; color_indic = Lime; UP_6 = 1; DOWN_6 = 0; }
   if ((FastMA_1_240 < FastMA_2_240)) { MAfast_Trend_240 = "DOWN"; x = 206; color_indic = Red; UP_6 = 0; DOWN_6 = 1; }

   
   double FastMA_1_1440 = iMA(NULL,PERIOD_D1,FastMAPeriod,0,MAMethod,MAPrice,shift_1440);
   double FastMA_2_1440 = iMA(NULL,PERIOD_D1,FastMAPeriod,0,MAMethod,MAPrice,shift_1440+1);
   
   if ((FastMA_1_1440 > FastMA_2_1440)) { MAfast_Trend_1440 = "UP"; x = 216; color_indic = Lime; UP_7 = 1; DOWN_7 = 0; }
   if ((FastMA_1_1440 < FastMA_2_1440)) { MAfast_Trend_1440 = "DOWN"; x = 206; color_indic = Red; UP_7 = 0; DOWN_7 = 1; }

   
   double FastMA_1_10080 = iMA(NULL,PERIOD_W1,FastMAPeriod,0,MAMethod,MAPrice,shift_10080);
   double FastMA_2_10080 = iMA(NULL,PERIOD_W1,FastMAPeriod,0,MAMethod,MAPrice,shift_10080+1);
   
   if ((FastMA_1_10080 > FastMA_2_10080)) { MAfast_Trend_10080 = "UP"; x = 216; color_indic = Lime; UP_8 = 1; DOWN_8 = 0; }
   if ((FastMA_1_10080 < FastMA_2_10080)) { MAfast_Trend_10080 = "DOWN"; x = 206; color_indic = Red; UP_8 = 0; DOWN_8 = 1; }

   
   // MEDIUM
   


   double MediumMA_1_1 = iMA(NULL,PERIOD_M1,MediumMAPeriod,0,MAMethod,MAPrice,shift_1);
   double MediumMA_2_1 = iMA(NULL,PERIOD_M1,MediumMAPeriod,0,MAMethod,MAPrice,shift_1+1);
   
   if ((MediumMA_1_1 > MediumMA_2_1)) { MAmedium_Trend_1 = "UP"; x = 266; color_indic = Lime; UP_9 = 1; DOWN_9 = 0; }
   if ((MediumMA_1_1 < MediumMA_2_1)) { MAmedium_Trend_1 = "DOWN"; x = 256; color_indic = Red; UP_9 = 0; DOWN_9 = 1; }

   
   double MediumMA_1_5 = iMA(NULL,PERIOD_M5,MediumMAPeriod,0,MAMethod,MAPrice,shift_5);
   double MediumMA_2_5 = iMA(NULL,PERIOD_M5,MediumMAPeriod,0,MAMethod,MAPrice,shift_5+1);
   
   if ((MediumMA_1_5 > MediumMA_2_5)) { MAmedium_Trend_5 = "UP"; x = 266; color_indic = Lime; UP_10 = 1; DOWN_10 = 0; }
   if ((MediumMA_1_5 < MediumMA_2_5)) { MAmedium_Trend_5 = "DOWN"; x = 256; color_indic = Red; UP_10 = 0; DOWN_10 = 1; }

   
   double MediumMA_1_15 = iMA(NULL,PERIOD_M15,MediumMAPeriod,0,MAMethod,MAPrice,shift_15);
   double MediumMA_2_15 = iMA(NULL,PERIOD_M15,MediumMAPeriod,0,MAMethod,MAPrice,shift_15+1);
   
   if ((MediumMA_1_15 > MediumMA_2_15)) { MAmedium_Trend_15 = "UP"; x = 266; color_indic = Lime; UP_11 = 1; DOWN_11 = 0; }
   if ((MediumMA_1_15 < MediumMA_2_15)) { MAmedium_Trend_15 = "DOWN"; x = 256; color_indic = Red; UP_11 = 0; DOWN_11 = 1; }

   
   double MediumMA_1_30 = iMA(NULL,PERIOD_M30,MediumMAPeriod,0,MAMethod,MAPrice,shift_30);
   double MediumMA_2_30 = iMA(NULL,PERIOD_M30,MediumMAPeriod,0,MAMethod,MAPrice,shift_30+1);
   
   if ((MediumMA_1_30 > MediumMA_2_30)) { MAmedium_Trend_30 = "UP"; x = 266; color_indic = Lime; UP_12 = 1; DOWN_12 = 0; }
   if ((MediumMA_1_30 < MediumMA_2_30)) { MAmedium_Trend_30 = "DOWN"; x = 256; color_indic = Red; UP_12 = 0; DOWN_12 = 1; }

   
   double MediumMA_1_60 = iMA(NULL,PERIOD_H1,MediumMAPeriod,0,MAMethod,MAPrice,shift_60);
   double MediumMA_2_60 = iMA(NULL,PERIOD_H1,MediumMAPeriod,0,MAMethod,MAPrice,shift_60+1);
   
   if ((MediumMA_1_60 > MediumMA_2_60)) { MAmedium_Trend_60 = "UP"; x = 266; color_indic = Lime; UP_13 = 1; DOWN_13 = 0; }
   if ((MediumMA_1_60 < MediumMA_2_60)) { MAmedium_Trend_60 = "DOWN"; x = 256; color_indic = Red; UP_13 = 0; DOWN_13 = 1; }

   
   double MediumMA_1_240 = iMA(NULL,PERIOD_H4,MediumMAPeriod,0,MAMethod,MAPrice,shift_240);
   double MediumMA_2_240 = iMA(NULL,PERIOD_H4,MediumMAPeriod,0,MAMethod,MAPrice,shift_240+1);
   
   if ((MediumMA_1_240 > MediumMA_2_240)) { MAmedium_Trend_240 = "UP"; x = 266; color_indic = Lime; UP_14 = 1; DOWN_14 = 0; }
   if ((MediumMA_1_240 < MediumMA_2_240)) { MAmedium_Trend_240 = "DOWN"; x = 256; color_indic = Red; UP_14 = 0; DOWN_14 = 1; }

   double MediumMA_1_1440 = iMA(NULL,PERIOD_D1,MediumMAPeriod,0,MAMethod,MAPrice,shift_1440);
   double MediumMA_2_1440 = iMA(NULL,PERIOD_D1,MediumMAPeriod,0,MAMethod,MAPrice,shift_1440+1);
   
   if ((MediumMA_1_1440 > MediumMA_2_1440)) { MAmedium_Trend_1440 = "UP"; x = 266; color_indic = Lime; UP_15 = 1; DOWN_15 = 0; }
   if ((MediumMA_1_1440 < MediumMA_2_1440)) { MAmedium_Trend_1440 = "DOWN"; x = 256; color_indic = Red; UP_15 = 0; DOWN_15 = 1; }

   
   double MediumMA_1_10080 = iMA(NULL,PERIOD_W1,MediumMAPeriod,0,MAMethod,MAPrice,shift_10080);
   double MediumMA_2_10080 = iMA(NULL,PERIOD_W1,MediumMAPeriod,0,MAMethod,MAPrice,shift_10080+1);
   
   if ((MediumMA_1_10080 > MediumMA_2_10080)) { MAmedium_Trend_10080 = "UP"; x = 266; color_indic = Lime; UP_16 = 1; DOWN_16 = 0; }
   if ((MediumMA_1_10080 < MediumMA_2_10080)) { MAmedium_Trend_10080 = "DOWN"; x = 256; color_indic = Red; UP_16 = 0; DOWN_16 = 1; }

   
   // SLOW
   

   

   
   double SlowMA_1_1 = iMA(NULL,PERIOD_M1,SlowMAPeriod,0,MAMethod,MAPrice,shift_1);
   double SlowMA_2_1 = iMA(NULL,PERIOD_M1,SlowMAPeriod,0,MAMethod,MAPrice,shift_1+1);
   
   if ((SlowMA_1_1 > SlowMA_2_1)) { MAslow_Trend_1 = "UP"; x = 316; color_indic = Lime; UP_17 = 1; DOWN_17 = 0; }
   if ((SlowMA_1_1 < SlowMA_2_1)) { MAslow_Trend_1 = "DOWN"; x = 306; color_indic = Red; UP_17 = 0; DOWN_17 = 1; }

   
   double SlowMA_1_5 = iMA(NULL,PERIOD_M5,SlowMAPeriod,0,MAMethod,MAPrice,shift_5);
   double SlowMA_2_5 = iMA(NULL,PERIOD_M5,SlowMAPeriod,0,MAMethod,MAPrice,shift_5+1);
   
   if ((SlowMA_1_5 > SlowMA_2_5)) { MAslow_Trend_5 = "UP"; x = 316; color_indic = Lime; UP_18 = 1; DOWN_18 = 0; }
   if ((SlowMA_1_5 < SlowMA_2_5)) { MAslow_Trend_5 = "DOWN"; x = 306; color_indic = Red; UP_18 = 0; DOWN_18 = 1; }

   
   double SlowMA_1_15 = iMA(NULL,PERIOD_M15,SlowMAPeriod,0,MAMethod,MAPrice,shift_15);
   double SlowMA_2_15 = iMA(NULL,PERIOD_M15,SlowMAPeriod,0,MAMethod,MAPrice,shift_15+1);
   
   if ((SlowMA_1_15 > SlowMA_2_15)) { MAslow_Trend_15 = "UP"; x = 316; color_indic = Lime; UP_19 = 1; DOWN_19 = 0; }
   if ((SlowMA_1_15 < SlowMA_2_15)) { MAslow_Trend_15 = "DOWN"; x = 306; color_indic = Red; UP_19 = 0; DOWN_19 = 1; }

   
   double SlowMA_1_30 = iMA(NULL,PERIOD_M30,SlowMAPeriod,0,MAMethod,MAPrice,shift_30);
   double SlowMA_2_30 = iMA(NULL,PERIOD_M30,SlowMAPeriod,0,MAMethod,MAPrice,shift_30+1);
   
   if ((SlowMA_1_30 > SlowMA_2_30)) { MAslow_Trend_30 = "UP"; x = 316; color_indic = Lime; UP_20 = 1; DOWN_20 = 0; }
   if ((SlowMA_1_30 < SlowMA_2_30)) { MAslow_Trend_30 = "DOWN"; x = 306; color_indic = Red; UP_20 = 0; DOWN_20 = 1; }
    
   double SlowMA_1_60 = iMA(NULL,PERIOD_H1,SlowMAPeriod,0,MAMethod,MAPrice,shift_60);
   double SlowMA_2_60 = iMA(NULL,PERIOD_H1,SlowMAPeriod,0,MAMethod,MAPrice,shift_60+1);
   
   if ((SlowMA_1_60 > SlowMA_2_60)) { MAslow_Trend_60 = "UP"; x = 316; color_indic = Lime; UP_21 = 1; DOWN_21 = 0; }
   if ((SlowMA_1_60 < SlowMA_2_60)) { MAslow_Trend_60 = "DOWN"; x = 306; color_indic = Red; UP_21 = 0; DOWN_21 = 1; }
   
   double SlowMA_1_240 = iMA(NULL,PERIOD_H4,SlowMAPeriod,0,MAMethod,MAPrice,shift_240);
   double SlowMA_2_240 = iMA(NULL,PERIOD_H4,SlowMAPeriod,0,MAMethod,MAPrice,shift_240+1);
   
   if ((SlowMA_1_240 > SlowMA_2_240)) { MAslow_Trend_240 = "UP"; x = 316; color_indic = Lime; UP_22 = 1; DOWN_22 = 0; }
   if ((SlowMA_1_240 < SlowMA_2_240)) { MAslow_Trend_240 = "DOWN"; x = 306; color_indic = Red; UP_22 = 0; DOWN_22 = 1; }
   
   double SlowMA_1_1440 = iMA(NULL,PERIOD_D1,SlowMAPeriod,0,MAMethod,MAPrice,shift_1440);
   double SlowMA_2_1440 = iMA(NULL,PERIOD_D1,SlowMAPeriod,0,MAMethod,MAPrice,shift_1440+1);
   
   if ((SlowMA_1_1440 > SlowMA_2_1440)) { MAslow_Trend_1440 = "UP"; x = 316; color_indic = Lime; UP_23 = 1; DOWN_23 = 0; }
   if ((SlowMA_1_1440 < SlowMA_2_1440)) { MAslow_Trend_1440 = "DOWN"; x = 306; color_indic = Red; UP_23 = 0; DOWN_23 = 1; }
 
   double SlowMA_1_10080 = iMA(NULL,PERIOD_W1,SlowMAPeriod,0,MAMethod,MAPrice,shift_10080);
   double SlowMA_2_10080 = iMA(NULL,PERIOD_W1,SlowMAPeriod,0,MAMethod,MAPrice,shift_10080+1);
   
   if ((SlowMA_1_10080 > SlowMA_2_10080)) { MAslow_Trend_10080 = "UP"; x = 316; color_indic = Lime; UP_24 = 1; DOWN_24 = 0; }
   if ((SlowMA_1_10080 < SlowMA_2_10080)) { MAslow_Trend_10080 = "DOWN"; x = 306; color_indic = Red; UP_24 = 0; DOWN_24 = 1; }
 
    

   objectBlank();   
   paintCol1(UP_1, UP_9, UP_17, UP_X1 );  
   paintCol2(UP_2, UP_10, UP_18, UP_X2 );   
   paintCol3(UP_3, UP_11, UP_19, UP_X3 );  
   paintCol4(UP_4, UP_12, UP_20, UP_X4 );       
   paintCol5(UP_5, UP_13, UP_21, UP_X5 );   
   paintCol6(UP_6, UP_14, UP_22, UP_X6 );  
   paintCol7(UP_7, UP_15, UP_23, UP_X7 );      

   paintLine();
    
//---- 
   return(0); 
  } 
//+------------------------------------------------------------------+ 


void initGraph()
  {
   deleteObject();


int xstart=myxstart, xinc=20;

int ystart=myystart, yinc=8;
int ystart1=ystart+yinc;
int ystart2=ystart+yinc*2;
int ystart3=ystart+yinc*3;
int ystart4=ystart+yinc*4;
int ystart5=ystart+yinc*5;
int ystart6=ystart+yinc*6;



   objectCreate("MA_1_6",xstart,ystart3);
//   objectCreate("MA_1_0",xstart,ystart5);
//   objectCreate("MA_1_1",xstart,ystart4);
//   objectCreate("MA_1_2",xstart,ystart3);
   objectCreate("MA_1_3",xstart,ystart2);
   objectCreate("MA_1_4",xstart,ystart1);   
   objectCreate("MA_1_5",xstart,ystart);
   objectCreate("MA_1",xstart+2,ystart+1,Period2Text(myPeriod1),8,"Arial Narrow",SkyBlue);
   objectCreate("MA_1p",xstart+4,ystart+10,DoubleToStr(9,1),8,"Arial Narrow",Silver);   
   

int xstart2 =  xstart - xinc ;

  
   objectCreate("MA_2_6",xstart2,ystart3); 
//   objectCreate("MA_2_0",xstart2,ystart5);
//   objectCreate("MA_2_1",xstart2,ystart4);
//   objectCreate("MA_2_2",xstart2,ystart3);
   objectCreate("MA_2_3",xstart2,ystart2);
   objectCreate("MA_2_4",xstart2,ystart1);   
   objectCreate("MA_2_5",xstart2,ystart);
   objectCreate("MA_2",xstart2+2,ystart+1,Period2Text(myPeriod2),8,"Arial Narrow",SkyBlue);
   objectCreate("MA_2p",xstart2+4,ystart+10,DoubleToStr(9,1),8,"Arial Narrow",Silver);

int xstart3 =  xstart2 - xinc ;

   objectCreate("MA_3_6",xstart3,ystart3);
//   objectCreate("MA_3_0",xstart3,ystart5);
//   objectCreate("MA_3_1",xstart3,ystart4);
//   objectCreate("MA_3_2",xstart3,ystart3);
   objectCreate("MA_3_3",xstart3,ystart2);
   objectCreate("MA_3_4",xstart3,ystart1);   
   objectCreate("MA_3_5",xstart3,ystart);
   objectCreate("MA_3",xstart3+2,ystart+1,Period2Text(myPeriod3),8,"Arial Narrow",SkyBlue);
   objectCreate("MA_3p",xstart3+4,ystart+10,DoubleToStr(9,1),8,"Arial Narrow",Silver);

int xstart4 =  xstart3 - xinc ;

   objectCreate("MA_4_6",xstart4,ystart3);
//   objectCreate("MA_4_0",xstart4,ystart5);
//   objectCreate("MA_4_1",xstart4,ystart4);
//   objectCreate("MA_4_2",xstart4,ystart3);
   objectCreate("MA_4_3",xstart4,ystart2);
   objectCreate("MA_4_4",xstart4,ystart1);   
   objectCreate("MA_4_5",xstart4,ystart);
   objectCreate("MA_4",xstart4+2,ystart+1,Period2Text(myPeriod4),8,"Arial Narrow",SkyBlue);
   objectCreate("MA_4p",xstart4+4,ystart+10,DoubleToStr(9,1),8,"Arial Narrow",Silver);

int xstart5 =  xstart4 - xinc ;

   objectCreate("MA_5_6",xstart5,ystart3);   
//   objectCreate("MA_5_0",xstart5,ystart5);
//   objectCreate("MA_5_1",xstart5,ystart4);
//   objectCreate("MA_5_2",xstart5,ystart3);
   objectCreate("MA_5_3",xstart5,ystart2);
   objectCreate("MA_5_4",xstart5,ystart1);   
   objectCreate("MA_5_5",xstart5,ystart);
   objectCreate("MA_5",xstart5+2,ystart+1,Period2Text(myPeriod5),8,"Arial Narrow",SkyBlue);
   objectCreate("MA_5p",xstart5+4,ystart+10,DoubleToStr(9,1),8,"Arial Narrow",Silver);
   
int xstart6 =  xstart5 - xinc ;   

   objectCreate("MA_6_6",xstart6,ystart3);
//   objectCreate("MA_6_0",xstart6,ystart5);
//   objectCreate("MA_6_1",xstart6,ystart4);
//   objectCreate("MA_6_2",xstart6,ystart3);
   objectCreate("MA_6_3",xstart6,ystart2);
   objectCreate("MA_6_4",xstart6,ystart1);   
   objectCreate("MA_6_5",xstart6,ystart);
   objectCreate("MA_6",xstart6+2,ystart+1,Period2Text(myPeriod6),8,"Arial Narrow",SkyBlue);
   objectCreate("MA_6p",xstart6+4,ystart+10,DoubleToStr(9,1),8,"Arial Narrow",Silver);

int xstart7 =  xstart6 - xinc ;  

   objectCreate("MA_7_6",xstart7,ystart3);
//   objectCreate("MA_7_0",xstart7,ystart5);
//   objectCreate("MA_7_1",xstart7,ystart4);
//   objectCreate("MA_7_2",xstart7,ystart3);
   objectCreate("MA_7_3",xstart7,ystart2);
   objectCreate("MA_7_4",xstart7,ystart1);   
   objectCreate("MA_7_5",xstart7,ystart);
   objectCreate("MA_7",xstart7+2,ystart+1,Period2Text(myPeriod7),8,"Arial Narrow",SkyBlue);
   objectCreate("MA_7p",xstart7+4,ystart+10,DoubleToStr(9,1),8,"Arial Narrow",Silver);
   
     
   objectCreate("line97",xstart7,ystart+70,"-- Moving Average Trend --",10,"Arial",DimGray);
   objectCreate("sign",xstart7,ystart-10,"»»» TRO MovAvg MULTI © «««",8,"Arial Narrow",DimGray);
   objectCreate("xma",xstart+24,ystart6-2,ExtraMAPeriod,8,"Arial Narrow",DimGray);  
   objectCreate("fma",xstart+24,ystart5-2,FastMAPeriod,8,"Arial Narrow",DimGray);   
   objectCreate("mma",xstart+24,ystart4-2,MediumMAPeriod ,8,"Arial Narrow",DimGray);  
   objectCreate("sma",xstart+24,ystart3-2,SlowMAPeriod ,8,"Arial Narrow",DimGray); 

    }
  
//+------------------------------------------------------------------+
void objectCreate(string name,int x,int y,string text="-",int size=42,
                  string font="Arial",color colour=CLR_NONE)
  {
   ObjectCreate(name,OBJ_LABEL,0,0,0);
   ObjectSet(name,OBJPROP_CORNER,3);
   ObjectSet(name,OBJPROP_COLOR,colour);
   ObjectSet(name,OBJPROP_XDISTANCE,x);
   ObjectSet(name,OBJPROP_YDISTANCE,y);
   ObjectSetText(name,text,size,font,colour);
  }
  
void deleteObject()
  {
   ObjectDelete("xma");   
   ObjectDelete("fma"); 
   ObjectDelete("mma"); 
   ObjectDelete("sma"); 
   ObjectDelete("sign"); 
   ObjectDelete("line97"); 
      
   ObjectDelete("MA_1_6"); 
   ObjectDelete("MA_1_0"); 
   ObjectDelete("MA_1_1");
   ObjectDelete("MA_1_2");
   ObjectDelete("MA_1_3");
   ObjectDelete("MA_1_4");  
   ObjectDelete("MA_1_5");
   ObjectDelete("MA_1");
   ObjectDelete("MA_1p");

   ObjectDelete("MA_2_6"); 
   ObjectDelete("MA_2_0"); 
   ObjectDelete("MA_2_1");
   ObjectDelete("MA_2_2");
   ObjectDelete("MA_2_3");
   ObjectDelete("MA_2_4");     
   ObjectDelete("MA_2_5");
   ObjectDelete("MA_2");
   ObjectDelete("MA_2p");

   ObjectDelete("MA_3_6");  
   ObjectDelete("MA_3_0"); 
   ObjectDelete("MA_3_1");
   ObjectDelete("MA_3_2");
   ObjectDelete("MA_3_3");
   ObjectDelete("MA_3_4");     
   ObjectDelete("MA_3_5");
   ObjectDelete("MA_3");
   ObjectDelete("MA_3p");

   ObjectDelete("MA_4_6");  
   ObjectDelete("MA_4_0"); 
   ObjectDelete("MA_4_1");
   ObjectDelete("MA_4_2");
   ObjectDelete("MA_4_3");
   ObjectDelete("MA_4_4");  
   ObjectDelete("MA_4_5");
   ObjectDelete("MA_4");
   ObjectDelete("MA_4p");
 
   ObjectDelete("MA_5_6");  
   ObjectDelete("MA_5_0"); 
   ObjectDelete("MA_5_1");
   ObjectDelete("MA_5_2");
   ObjectDelete("MA_5_3");
   ObjectDelete("MA_5_4");    
   ObjectDelete("MA_5_5");
   ObjectDelete("MA_5");
   ObjectDelete("MA_5p"); 
 
   ObjectDelete("MA_6_6");  
   ObjectDelete("MA_6_0"); 
   ObjectDelete("MA_6_1");
   ObjectDelete("MA_6_2");
   ObjectDelete("MA_6_3");
   ObjectDelete("MA_6_4");      
   ObjectDelete("MA_6_5");
   ObjectDelete("MA_6");
   ObjectDelete("MA_6p");
 
   ObjectDelete("MA_7_6");  
   ObjectDelete("MA_7_0"); 
   ObjectDelete("MA_7_1");
   ObjectDelete("MA_7_2");
   ObjectDelete("MA_7_3");
   ObjectDelete("MA_7_4");     
   ObjectDelete("MA_7_5");
   ObjectDelete("MA_7");
   ObjectDelete("MA_7p");
   
  }
  
void objectBlank()
  {
   ObjectSet("MA_1_6",OBJPROP_COLOR,CLR_NONE);  
   ObjectSet("MA_1_0",OBJPROP_COLOR,CLR_NONE); 
   ObjectSet("MA_1_1",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_1_2",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_1_3",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_1_4",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_1_5",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_1",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_1p",OBJPROP_COLOR,CLR_NONE);

   ObjectSet("MA_2_6",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_2_0",OBJPROP_COLOR,CLR_NONE); 
   ObjectSet("MA_2_1",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_2_2",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_2_3",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_2_4",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_2_5",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_2",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_2p",OBJPROP_COLOR,CLR_NONE);

   ObjectSet("MA_3_6",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_3_0",OBJPROP_COLOR,CLR_NONE); 
   ObjectSet("MA_3_1",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_3_2",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_3_3",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_3_4",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_3_5",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_3",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_3p",OBJPROP_COLOR,CLR_NONE);
   
   ObjectSet("MA_4_6",OBJPROP_COLOR,CLR_NONE); 
   ObjectSet("MA_4_0",OBJPROP_COLOR,CLR_NONE); 
   ObjectSet("MA_4_1",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_4_2",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_4_3",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_4_4",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_4_5",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_4",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_4p",OBJPROP_COLOR,CLR_NONE);
   
   ObjectSet("MA_5_6",OBJPROP_COLOR,CLR_NONE); 
   ObjectSet("MA_5_0",OBJPROP_COLOR,CLR_NONE); 
   ObjectSet("MA_5_1",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_5_2",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_5_3",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_5_4",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_5_5",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_5",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_5p",OBJPROP_COLOR,CLR_NONE);
   
   ObjectSet("MA_6_6",OBJPROP_COLOR,CLR_NONE); 
   ObjectSet("MA_6_0",OBJPROP_COLOR,CLR_NONE); 
   ObjectSet("MA_6_1",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_6_2",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_6_3",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_6_4",OBJPROP_COLOR,CLR_NONE);    
   ObjectSet("MA_6_5",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_6",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_6p",OBJPROP_COLOR,CLR_NONE);
   
   ObjectSet("MA_7_6",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_7_0",OBJPROP_COLOR,CLR_NONE); 
   ObjectSet("MA_7_1",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_7_2",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_7_3",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_7_4",OBJPROP_COLOR,CLR_NONE);   
   ObjectSet("MA_7_5",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_7",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("MA_7p",OBJPROP_COLOR,CLR_NONE);      
   
   ObjectSet("line98",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("line97",OBJPROP_COLOR,CLR_NONE); 
   ObjectSet("xma",OBJPROP_COLOR,CLR_NONE);   
   ObjectSet("fma",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("mma",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("sma",OBJPROP_COLOR,CLR_NONE);
   ObjectSet("line97",OBJPROP_COLOR,CLR_NONE); 
   

  }
  
void paintCol1(double value1, double value2, double value3, double value4 )
  { 
   if (value4 == 1) ObjectSet("MA_1_6",OBJPROP_COLOR,Lime);
   if (value4 == 0) ObjectSet("MA_1_6",OBJPROP_COLOR,Red);
   if (value3 == 1) ObjectSet("MA_1_5",OBJPROP_COLOR,Lime);
   if (value3 == 0) ObjectSet("MA_1_5",OBJPROP_COLOR,Red);  
   if (value2 == 1) ObjectSet("MA_1_4",OBJPROP_COLOR,Lime);
   if (value2 == 0) ObjectSet("MA_1_4",OBJPROP_COLOR,Red); 
   if (value1 == 1) ObjectSet("MA_1_3",OBJPROP_COLOR,Lime);
   if (value1 == 0) ObjectSet("MA_1_3",OBJPROP_COLOR,Red);     
   ObjectSet("MA_1",OBJPROP_COLOR,SkyBlue);
//   ObjectSetText("MA_1p",DoubleToStr(value*100,0),8,"Arial Narrow",Silver);
//   GlobalVariableSet("MA_1",value);
  }
  
void paintCol2(double value1, double value2, double value3, double value4  )
  {
   if (value4 == 1) ObjectSet("MA_2_6",OBJPROP_COLOR,Lime);
   if (value4 == 0) ObjectSet("MA_2_6",OBJPROP_COLOR,Red);  
   if (value3 == 1) ObjectSet("MA_2_5",OBJPROP_COLOR,Lime);
   if (value3 == 0) ObjectSet("MA_2_5",OBJPROP_COLOR,Red);  
   if (value2 == 1) ObjectSet("MA_2_4",OBJPROP_COLOR,Lime);
   if (value2 == 0) ObjectSet("MA_2_4",OBJPROP_COLOR,Red); 
   if (value1 == 1) ObjectSet("MA_2_3",OBJPROP_COLOR,Lime);
   if (value1 == 0) ObjectSet("MA_2_3",OBJPROP_COLOR,Red);     
   ObjectSet("MA_2",OBJPROP_COLOR,SkyBlue);
//   ObjectSetText("MA_2p",DoubleToStr(value*100,0),8,"Arial Narrow",Silver);
// GlobalVariableSet("MA_2",value);
  }


void paintCol3(double value1, double value2, double value3, double value4  )
  {
   if (value4 == 1) ObjectSet("MA_3_6",OBJPROP_COLOR,Lime);
   if (value4 == 0) ObjectSet("MA_3_6",OBJPROP_COLOR,Red);  
   if (value3 == 1) ObjectSet("MA_3_5",OBJPROP_COLOR,Lime);
   if (value3 == 0) ObjectSet("MA_3_5",OBJPROP_COLOR,Red);  
   if (value2 == 1) ObjectSet("MA_3_4",OBJPROP_COLOR,Lime);
   if (value2 == 0) ObjectSet("MA_3_4",OBJPROP_COLOR,Red); 
   if (value1 == 1) ObjectSet("MA_3_3",OBJPROP_COLOR,Lime);
   if (value1 == 0) ObjectSet("MA_3_3",OBJPROP_COLOR,Red);    
   ObjectSet("MA_3",OBJPROP_COLOR,SkyBlue);
//   ObjectSetText("MA_3p",DoubleToStr(value*100,0),8,"Arial Narrow",Silver);
//   GlobalVariableSet("MA_3",value);
  }

void paintCol4(double value1, double value2, double value3, double value4  )
  {
   if (value4 == 1) ObjectSet("MA_4_6",OBJPROP_COLOR,Lime);
   if (value4 == 0) ObjectSet("MA_4_6",OBJPROP_COLOR,Red);  
   if (value3 == 1) ObjectSet("MA_4_5",OBJPROP_COLOR,Lime);
   if (value3 == 0) ObjectSet("MA_4_5",OBJPROP_COLOR,Red);  
   if (value2 == 1) ObjectSet("MA_4_4",OBJPROP_COLOR,Lime);
   if (value2 == 0) ObjectSet("MA_4_4",OBJPROP_COLOR,Red); 
   if (value1 == 1) ObjectSet("MA_4_3",OBJPROP_COLOR,Lime);
   if (value1 == 0) ObjectSet("MA_4_3",OBJPROP_COLOR,Red);      
   ObjectSet("MA_4",OBJPROP_COLOR,SkyBlue);
//   ObjectSetText("MA_4p",DoubleToStr(value*100,0),8,"Arial Narrow",Silver);
//   GlobalVariableSet("MA_4",value);
  }

void paintCol5(double value1, double value2, double value3, double value4  )
  {
   if (value4 == 1) ObjectSet("MA_5_6",OBJPROP_COLOR,Lime);
   if (value4 == 0) ObjectSet("MA_5_6",OBJPROP_COLOR,Red);   
   if (value3 == 1) ObjectSet("MA_5_5",OBJPROP_COLOR,Lime);
   if (value3 == 0) ObjectSet("MA_5_5",OBJPROP_COLOR,Red);  
   if (value2 == 1) ObjectSet("MA_5_4",OBJPROP_COLOR,Lime);
   if (value2 == 0) ObjectSet("MA_5_4",OBJPROP_COLOR,Red); 
   if (value1 == 1) ObjectSet("MA_5_3",OBJPROP_COLOR,Lime);
   if (value1 == 0) ObjectSet("MA_5_3",OBJPROP_COLOR,Red);     
   ObjectSet("MA_5",OBJPROP_COLOR,SkyBlue);
//   ObjectSetText("MA_5p",DoubleToStr(value*100,0),8,"Arial Narrow",Silver);
//   GlobalVariableSet("MA_5",value);
  }

void paintCol6(double value1, double value2, double value3, double value4  )
  {
   if (value4 == 1) ObjectSet("MA_6_6",OBJPROP_COLOR,Lime);
   if (value4 == 0) ObjectSet("MA_6_6",OBJPROP_COLOR,Red);   
   if (value3 == 1) ObjectSet("MA_6_5",OBJPROP_COLOR,Lime);
   if (value3 == 0) ObjectSet("MA_6_5",OBJPROP_COLOR,Red);  
   if (value2 == 1) ObjectSet("MA_6_4",OBJPROP_COLOR,Lime);
   if (value2 == 0) ObjectSet("MA_6_4",OBJPROP_COLOR,Red); 
   if (value1 == 1) ObjectSet("MA_6_3",OBJPROP_COLOR,Lime);
   if (value1 == 0) ObjectSet("MA_6_3",OBJPROP_COLOR,Red);    
   ObjectSet("MA_6",OBJPROP_COLOR,SkyBlue);
//   ObjectSetText("MA_6p",DoubleToStr(value*100,0),8,"Arial Narrow",Silver);
//   GlobalVariableSet("MA_6",value);
  }

void paintCol7(double  value1, double value2, double value3, double value4  )
  {
   if (value4 == 1) ObjectSet("MA_7_6",OBJPROP_COLOR,Lime);
   if (value4 == 0) ObjectSet("MA_7_6",OBJPROP_COLOR,Red);  
   if (value3 == 1) ObjectSet("MA_7_5",OBJPROP_COLOR,Lime);
   if (value3 == 0) ObjectSet("MA_7_5",OBJPROP_COLOR,Red);  
   if (value2 == 1) ObjectSet("MA_7_4",OBJPROP_COLOR,Lime);
   if (value2 == 0) ObjectSet("MA_7_4",OBJPROP_COLOR,Red); 
   if (value1 == 1) ObjectSet("MA_7_3",OBJPROP_COLOR,Lime);
   if (value1 == 0) ObjectSet("MA_7_3",OBJPROP_COLOR,Red);   
   ObjectSet("MA_7",OBJPROP_COLOR,SkyBlue);
//   ObjectSetText("MA_7p",DoubleToStr(value*100,0),8,"Arial Narrow",Silver);
//   GlobalVariableSet("MA_7",value);
  }
  

  
void paintLine()
  {
   ObjectSet("line98",OBJPROP_COLOR,DimGray);
   ObjectSet("line97",OBJPROP_COLOR,DimGray);
   ObjectSet("xma",OBJPROP_COLOR,DimGray);   
   ObjectSet("fma",OBJPROP_COLOR,DimGray);
   ObjectSet("mma",OBJPROP_COLOR,DimGray);
   ObjectSet("sma",OBJPROP_COLOR,DimGray);
   
  }