//+------------------------------------------------------------------+ 
//|   cm_Trade5                                                      | 
//|                                                                  | 
//|   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= 200 ; 


extern int   myFontSize       = 60;

extern string Buy_Message  = "BUY" ;
extern string Wait_Message = "WAIT" ;
extern string Sell_Message = "SELL SHORT" ;
extern string Rdy_Message  = "GET READY" ;

extern color Buy_color = Lime;
extern color Wait_color = Yellow;
extern color Sell_color = Red;
extern color Rdy_color = Orange;

//---- indicator buffers 



//---- buffers


string tMessage ;
//+--------- TRO MODIFICATION ---------------------------------------+ 
string symbol, tChartPeriod,  tShortName, oldmsg = "" ;  
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 = "xyz"+ symbol + tChartPeriod  ;

   return(0); 
  } 

int deinit() 
{ 

   
   ObjectDelete("XYZ530");
   ObjectDelete("XYZ529");
   ObjectDelete("XYZ529B");
   ObjectDelete("XYZ531");
   ObjectDelete("XYZ532");
   ObjectDelete("XYZ534");   
   
   ObjectDelete("XYZ530");
   ObjectDelete("XYZ529");
   ObjectDelete("XYZ529B");
   ObjectDelete("XYZ531");
   ObjectDelete("XYZ532");
   ObjectDelete("XYZ534");   
}  

//+------------------------------------------------------------------+ 
//| Range                                                            | 
//+------------------------------------------------------------------+ 
int start() 
  { 
  
double cEMA   = iMA(NULL, period, 5, 0, 1, PRICE_CLOSE,0); 
double pEMA   = iMA(NULL, period, 5, 0, 1, PRICE_CLOSE,1);  
 

color HighColor, LowColor, MidColor, Mid1Color, CloseColor, ClOpColor;

tMessage  = Wait_Message ;
ClOpColor = Wait_color ;


while(true)
{

if( Close[0] > cEMA && cEMA > pEMA  )
{ 
   if( tMessage != oldmsg ) { tMessage = Buy_Message ; ClOpColor = Buy_color ; break ; }
}


if( Close[0] < cEMA &&  cEMA < pEMA )
{ 
   if( tMessage != oldmsg )  { tMessage = Sell_Message ; ClOpColor = Sell_color ; break ; }
}

if( Close[0] > cEMA  ) { tMessage = "LONG" ; ClOpColor = Buy_color ; break ; } 

if( Close[0] < cEMA  ) { tMessage = "SHORT" ; ClOpColor = Sell_color ; break ; } 

tMessage = Wait_Message ; ClOpColor = Wait_color ;  
 
break;

} // while

oldmsg =  tMessage ;

//+------------------------------------------------------------------+  
                    
   ObjectCreate("XYZ531", OBJ_LABEL, win, 0, 0);//HiLow LABEL
   ObjectSetText("XYZ531",tMessage, myFontSize , "Arial Bold", ClOpColor );
   ObjectSet("XYZ531", OBJPROP_CORNER, 0);
   ObjectSet("XYZ531", OBJPROP_XDISTANCE, price.x.offset); 
   ObjectSet("XYZ531", 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); 
} 

//+------------------------------------------------------------------+

 