//+------------------------------------------------------------------+ 
//|   cm_Temp                                                        | 
//|                                                                  | 
//|   Copyright © 2008, Avery T. Horton, Jr. aka TheRumpledOne       |
//|                                                                  |
//|   PO BOX 43575, TUCSON, AZ 85733                                 |
//|                                                                  |
//|   GIFTS AND DONATIONS ACCEPTED                                   | 
//|                                                                  |
//|   therumpledone@gmail.com                                        |  
//+------------------------------------------------------------------+ 


#property  copyright "Copyright © 2008, Avery T. Horton, Jr. aka TRO" 
#property  link      "http://www.therumpledone.com/" 

//---- indicator settings 
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_minimum 0
#property indicator_maximum 1



//---- indicator parameters  
 

extern int win = 0;
extern int price.x.offset= 0 ; 
extern int price.y.offset= 10 ; 


extern int   myFontSize       = 60;

extern string L6_Message  = "HOT" ;
extern string L5_Message  = "WARMER" ;
extern string L4_Message  = "WARM" ;
extern string L3_Message  = "COOL" ;
extern string L2_Message  = "COOLER" ;
extern string L1_Message  = "COLD" ;

extern color L6_color = Red;
extern color L5_color = Orange;
extern color L4_color = Yellow;
extern color L3_color = Aqua;
extern color L2_color = Blue;
extern color L1_color = Navy;

//---- indicator buffers 



//---- buffers


string tMessage , oldmsg = "" ; 
//+--------- TRO MODIFICATION ---------------------------------------+ 
string symbol, tChartPeriod,  tShortName ;  
int    digits, period  ; 

datetime Trigger ;

int OldBars = -1 ;

color tColor = Yellow ;

//+------------------------------------------------------------------+ 
//| Custom indicator initialization function                         | 
//+------------------------------------------------------------------+ 
int init() 
  { 
   period       = Period() ;     
//   tChartPeriod =  TimeFrameToString(period) ;
   symbol       =  Symbol() ;
   digits       =  Digits ;   

   tShortName = "temp"+ symbol + tChartPeriod  ;

   return(0); 
  } 

int deinit() 
{ 

   
   ObjectDelete("temp30");
   ObjectDelete("temp29");
   ObjectDelete("temp29B");
   ObjectDelete("temp31");
   ObjectDelete("temp32");
   ObjectDelete("temp34");   
   
   ObjectDelete("temp30");
   ObjectDelete("temp29");
   ObjectDelete("temp29B");
   ObjectDelete("temp31");
   ObjectDelete("temp32");
   ObjectDelete("temp34");   
}  

//+------------------------------------------------------------------+ 
//| Range                                                            | 
//+------------------------------------------------------------------+ 
int start() 
  { 
 
double cClose  = iClose(NULL,period ,0) ; 
  
double pHigh   = iHigh(NULL,period ,1) ; 
double pOpen   = iOpen(NULL,period ,1) ; 
double pClose  = iClose(NULL,period ,1) ;
double pLow    = iLow(NULL,period ,1) ; 

double pMid    = ( pHigh + pLow ) * 0.50 ; 
       pMid    =  NormalizeDouble( pMid, Digits ) ;
       
double pTop    =  MathMax( pOpen, pClose ) ;    
double pBot    =  MathMin( pOpen, pClose ) ; 


double Level4  = MathMax( pTop, pMid ) ; 
double Level3  = MathMax( pBot, pMid ) ; 
double Level2  = MathMin( pBot, pMid ) ;

color ClOpColor;


while(true)
{

if( cClose  > pHigh ) { tMessage = L6_Message ; ClOpColor = L6_color ; break ; }

if( cClose  > Level4 ) { tMessage = L5_Message ; ClOpColor = L5_color ; break ; }

if( cClose  > Level3 ) { tMessage = L4_Message ; ClOpColor = L4_color ; break ; }

if( cClose  > Level2 ) { tMessage = L3_Message ; ClOpColor = L3_color ; break ; }

if( cClose  > pLow ) { tMessage = L2_Message ; ClOpColor = L2_color ; break ; }

                       tMessage = L1_Message ; ClOpColor = L1_color ;    
 

break;

} // while

oldmsg =  tMessage ;

//+------------------------------------------------------------------+  
                    
   ObjectCreate("temp31", OBJ_LABEL, win, 0, 0);//HiLow LABEL
   ObjectSetText("temp31",tMessage, myFontSize , "Arial Bold", ClOpColor );
   ObjectSet("temp31", OBJPROP_CORNER, 0);
   ObjectSet("temp31", OBJPROP_XDISTANCE, price.x.offset); 
   ObjectSet("temp31", OBJPROP_YDISTANCE, price.y.offset); 


 string note2 = "Default Font Color";
 color  cmFontColor              = DimGray;
 string note3                  = "Font Size";
 int cmFontSize                  = 8;
 string note4                  = "Font Type";
 string cmFontType               = "Verdana"; // Tahoma Courier
string RAN953 =  ">>>> CODEMUNCHER@GMAIL.COM <<<<"  ;   
string tObjName03 = "cmtagtpbi"  ; 
    
   ObjectCreate(tObjName03, OBJ_LABEL, 0, 0, 0);//HiLow LABEL
   ObjectSetText(tObjName03, RAN953 , cmFontSize ,  cmFontType,  cmFontColor );
   ObjectSet(tObjName03, OBJPROP_CORNER, 3);
   ObjectSet(tObjName03, OBJPROP_XDISTANCE,  5 );
   ObjectSet(tObjName03, OBJPROP_YDISTANCE, 10); 
//+------------------------------------------------------------------+        

   WindowRedraw();    
 

   return(0); 
} 

//+------------------------------------------------------------------+

 