//+------------------------------------------------------------------+ 
//|   _TRO_Multi_Meter_Stochastic                                    | 
//|                                                                  | 
//|   Copyright © 2007, Avery T. Horton, Jr. aka TheRumpledOne       |
//|                                                                  |
//|   PO BOX 43575, TUCSON, AZ 85733                                 |
//|                                                                  |
//|   GIFT AND DONATIONS ACCEPTED                                    | 
//|                                                                  |
//|   therumpldone@gmail.com                                         |  
//+------------------------------------------------------------------+ 
//|                                                                  |
//| go to www.kreslik.com for the latest indicator updates           |  
//+------------------------------------------------------------------+ 
//|                                                                  |
//| Use mbtrading as your forex broker...                            |  
//| http://therumpledone.mbtrading.com/fx/demo.asp                   |  
//+------------------------------------------------------------------+ 


#property indicator_chart_window

extern bool Show_Heading = false;
 
extern string IndName = "STOCH" ; // change

extern bool Corner_of_Chart_RIGHT_TOP = true;

extern int Shift_UP_DN =60; 
extern int Adjust_Side_to_side  = 20;

extern color BarLabel_color = LightBlue;
extern color CommentLabel_color = LightBlue;

//******************* 
// change inputs for your indicator 

extern int KPeriod=8;
extern int DPeriod=3;
extern int Slowing=3;
extern int MAMethod=0;
extern int PriceField=0; 

extern double Level5 =  95 ;
extern double Level4 =  80 ;
extern double Level3 =  50 ;
extern double Level2 =  20 ;
extern double Level1 =  5 ;
extern double Level0 =  0 ;

extern color colorLevel5 =  Red ;
extern color colorLevel4 =  Crimson ;
extern color colorLevel3 =  Gray  ;
extern color colorLevel2 =  DarkGray ;
extern color colorLevel1 =  MediumBlue ;
extern color colorLevel0 =  Navy;
//*******************


string Obj0001,Obj0002,Obj0003,Obj0004,Obj0005,Obj0006,Obj0007,Obj0008,Obj0009;  
//+---------------

color MeterColor( double rsimeter )
{
if( rsimeter > Level5 ) { return( colorLevel5 ); } 
if( rsimeter > Level4 ) { return( colorLevel4 ); } 
if( rsimeter > Level3 ) { return( colorLevel3 ); } 
if( rsimeter > Level2 ) { return( colorLevel2 ); } 
if( rsimeter > Level1 ) { return( colorLevel1 ); } 
return( colorLevel0 );  
}
//+---------------

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- 


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

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {    
   //***********************************************************************************************************************

string LabelTime="";

if (LabelTime=="") {LabelTime=TimeToStr(TimeLocal(),TIME_SECONDS); }

   int    counted_bars=IndicatorCounted();
   
if ( Show_Heading) {         
    if (Corner_of_Chart_RIGHT_TOP == true)
    {  

   Obj0001 = "STOCH_Head" + LabelTime ; 
   string STOCH_Head = "    M1  M5  M15 M30 H1  H4   D1" ;
   
       
           ObjectCreate(Obj0001, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0001,STOCH_Head , 7, "Tahoma Narrow", BarLabel_color);
   ObjectSet(Obj0001, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0001, OBJPROP_XDISTANCE, 17+Adjust_Side_to_side);
   ObjectSet(Obj0001, OBJPROP_YDISTANCE, 28+Shift_UP_DN); 
   }
    if (Corner_of_Chart_RIGHT_TOP == false)
   { 
           ObjectCreate(Obj0001, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0001, STOCH_Head , 7, "Tahoma Narrow", BarLabel_color);
   ObjectSet(Obj0001, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0001, OBJPROP_XDISTANCE, 17+Adjust_Side_to_side);
   ObjectSet(Obj0001, OBJPROP_YDISTANCE, 24+Shift_UP_DN); 
    } 
} // Show_Heading

 //*******************   change for  your indicator ********************

string M1_STOCH= "",M5_STOCH= "", M15_STOCH= "", M30_STOCH= "", H1_STOCH= "", H4_STOCH= "", D1_STOCH= "",PRC1;
color  color_STOCHm1,color_STOCHm5,color_STOCHm15,color_STOCHm30,color_STOCHm60,color_STOCHm240,color_STOCHm1440;     
    
double STOCH_M1=iStochastic(NULL,PERIOD_M1,KPeriod,DPeriod,Slowing,MAMethod,PriceField,0,0);
  
double STOCH_M5=iStochastic(NULL,PERIOD_M5,KPeriod,DPeriod,Slowing,MAMethod,PriceField,0,0);

double STOCH_M15=iStochastic(NULL,PERIOD_M15,KPeriod,DPeriod,Slowing,MAMethod,PriceField,0,0);

double STOCH_M30=iStochastic(NULL,PERIOD_M30,KPeriod,DPeriod,Slowing,MAMethod,PriceField,0,0);
      
double STOCH_H1=iStochastic(NULL,PERIOD_H1,KPeriod,DPeriod,Slowing,MAMethod,PriceField,0,0);

double STOCH_H4=iStochastic(NULL,PERIOD_H4,KPeriod,DPeriod,Slowing,MAMethod,PriceField,0,0);
 
double STOCH_D1=iStochastic(NULL,PERIOD_D1,KPeriod,DPeriod,Slowing,MAMethod,PriceField,0,0);
   
M1_STOCH= "-";  color_STOCHm1 = MeterColor( STOCH_M1 ) ;
M5_STOCH= "-";  color_STOCHm5 = MeterColor( STOCH_M5 ) ;
M15_STOCH= "-";color_STOCHm15 = MeterColor( STOCH_M15 ) ;
M30_STOCH= "-";color_STOCHm30 = MeterColor( STOCH_M30 ) ;
H1_STOCH= "-";color_STOCHm60 = MeterColor( STOCH_H1 ) ;
H4_STOCH= "-";color_STOCHm240 = MeterColor( STOCH_H4 ) ;
D1_STOCH= "-";color_STOCHm1440 = MeterColor( STOCH_D1 ) ;
    

   Obj0002 = "SignalSTOCHM1t" + LabelTime ; 
           
           ObjectCreate(Obj0002, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0002,IndName, 7, "Tahoma Narrow",  BarLabel_color);  
   ObjectSet(Obj0002, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0002, OBJPROP_XDISTANCE, 155+Adjust_Side_to_side);
   ObjectSet(Obj0002, OBJPROP_YDISTANCE, 50+Shift_UP_DN);  

   Obj0003 = "SignalSTOCHM1" + LabelTime ;        
           ObjectCreate(Obj0003, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0003, M1_STOCH, 40, "Tahoma Narrow",  color_STOCHm1);
   ObjectSet(Obj0003, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0003, OBJPROP_XDISTANCE, 130+Adjust_Side_to_side);
   ObjectSet(Obj0003, OBJPROP_YDISTANCE, 20+Shift_UP_DN); 

   Obj0004 = "SignalSTOCHM5" + LabelTime ;          
           ObjectCreate(Obj0004, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0004, M5_STOCH, 40, "Tahoma Narrow",  color_STOCHm5);
   ObjectSet(Obj0004, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0004, OBJPROP_XDISTANCE, 110+Adjust_Side_to_side);
   ObjectSet(Obj0004, OBJPROP_YDISTANCE, 20+Shift_UP_DN); 
      
   Obj0005 = "SignalSTOCHM15" + LabelTime ; 
   ObjectCreate(Obj0005, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0005, M15_STOCH, 40, "Tahoma Narrow",  color_STOCHm15);
   ObjectSet(Obj0005, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0005, OBJPROP_XDISTANCE, 90+Adjust_Side_to_side);
   ObjectSet(Obj0005, OBJPROP_YDISTANCE, 20+Shift_UP_DN); 
      
   Obj0006 = "SignalSTOCHM30" + LabelTime ; 
   ObjectCreate(Obj0006, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0006, M30_STOCH, 40, "Tahoma Narrow",  color_STOCHm30);
   ObjectSet(Obj0006, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0006, OBJPROP_XDISTANCE, 70+Adjust_Side_to_side);
   ObjectSet(Obj0006, OBJPROP_YDISTANCE, 20+Shift_UP_DN); 

   Obj0007 = "SignalSTOCHM60" + LabelTime ;      
           ObjectCreate(Obj0007, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0007, H1_STOCH, 40, "Tahoma Narrow",  color_STOCHm60);
   ObjectSet(Obj0007, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0007, OBJPROP_XDISTANCE, 50+Adjust_Side_to_side);
   ObjectSet(Obj0007, OBJPROP_YDISTANCE, 20+Shift_UP_DN); 

   Obj0008 = "SignalSTOCHM240" + LabelTime ;          
           ObjectCreate(Obj0008, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0008, H4_STOCH, 40, "Tahoma Narrow",  color_STOCHm240);
   ObjectSet(Obj0008, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0008, OBJPROP_XDISTANCE, 30+Adjust_Side_to_side);
   ObjectSet(Obj0008, OBJPROP_YDISTANCE, 20+Shift_UP_DN);

   Obj0009 = "SignalSTOCHM1440" + LabelTime ;    
           ObjectCreate(Obj0009, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(Obj0009, D1_STOCH, 40, "Tahoma Narrow",  color_STOCHm1440);
   ObjectSet(Obj0009, OBJPROP_CORNER, Corner_of_Chart_RIGHT_TOP);
   ObjectSet(Obj0009, OBJPROP_XDISTANCE, 10+Adjust_Side_to_side);
   ObjectSet(Obj0009, OBJPROP_YDISTANCE, 20+Shift_UP_DN);
  
 //----
   return(0);
  }
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----


deleteObject(); 

//----
   return(0);
  }
  
void deleteObject()
  { 
ObjectDelete(Obj0001);  
ObjectDelete(Obj0002); 
ObjectDelete(Obj0003); 
ObjectDelete(Obj0004); 
ObjectDelete(Obj0005); 
ObjectDelete(Obj0006); 
ObjectDelete(Obj0007); 
ObjectDelete(Obj0008); 
ObjectDelete(Obj0009); 
 
  }
  
  /*double STOCH_M1=iStochastic(NULL,PERIOD_M1,KPeriod,DPeriod,Slowing,MAMethod,PriceField,0,0);
double STOCH_m1=iStochastic(NULL,PERIOD_M1,KPeriod,DPeriod,Slowing,MAMethod,PriceField,1,0);
   
double STOCH_M5=iStochastic(NULL,PERIOD_M5,KPeriod,DPeriod,Slowing,MAMethod,PriceField,0,0);
double STOCH_m5=iStochastic(NULL,PERIOD_M5,KPeriod,DPeriod,Slowing,MAMethod,PriceField,1,0);

double STOCH_M15=iStochastic(NULL,PERIOD_M15,KPeriod,DPeriod,Slowing,MAMethod,PriceField,0,0);
double STOCH_m15=iStochastic(NULL,PERIOD_M15,KPeriod,DPeriod,Slowing,MAMethod,PriceField,1,0);

double STOCH_M30=iStochastic(NULL,PERIOD_M30,KPeriod,DPeriod,Slowing,MAMethod,PriceField,0,0);
double STOCH_m30=iStochastic(NULL,PERIOD_M30,KPeriod,DPeriod,Slowing,MAMethod,PriceField,1,0);
      
double STOCH_H1=iStochastic(NULL,PERIOD_H1,KPeriod,DPeriod,Slowing,MAMethod,PriceField,0,0);
double STOCH_h1=iStochastic(NULL,PERIOD_H1,KPeriod,DPeriod,Slowing,MAMethod,PriceField,1,0);
 
double STOCH_H4=iStochastic(NULL,PERIOD_H4,KPeriod,DPeriod,Slowing,MAMethod,PriceField,0,0);
double STOCH_h4=iStochastic(NULL,PERIOD_H4,KPeriod,DPeriod,Slowing,MAMethod,PriceField,1,0);
  
double STOCH_D1=iStochastic(NULL,PERIOD_D1,KPeriod,DPeriod,Slowing,MAMethod,PriceField,0,0);
double STOCH_d1=iStochastic(NULL,PERIOD_D1,KPeriod,DPeriod,Slowing,MAMethod,PriceField,1,0);
 */