//+------------------------------------------------------------------+ 
//|   _TRO_2_CANDLE_TREND                                            | 
//|                                                                  | 
//|   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= 400 ; 

extern int   Chart_Period1    = 15;
extern int   Chart_Period2    = 60;

extern int   myFontSize       = 120;

extern string Up_Message = "LONG" ;
extern string Eq_Message = "CAUTION" ;
extern string Dn_Message = "SHORT" ;

extern color Up_color = Lime;
extern color Eq_color = Orange;
extern color Dn_color = Red;


//---- indicator buffers 



//---- buffers


string tMessage ;

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


   return(0); 
  } 

int deinit() 
{ 

   
   ObjectDelete("2CAN30");
   ObjectDelete("2CAN29");
   ObjectDelete("2CAN29B");
   ObjectDelete("2CAN31");
   ObjectDelete("2CAN32");
   ObjectDelete("2CAN34");   
   
   ObjectDelete("CAN230");
   ObjectDelete("CAN229");
   ObjectDelete("CAN229B");
   ObjectDelete("CAN231");
   ObjectDelete("CAN232");
   ObjectDelete("CAN234");   
}  

//+------------------------------------------------------------------+ 
//| Range                                                            | 
//+------------------------------------------------------------------+ 
int start() 
  { 
  
double xopen   = iOpen(NULL,Chart_Period1,0) ; 
double xclose  = iClose(NULL,Chart_Period1,0) ; 

double yopen   = iOpen(NULL,Chart_Period2,0) ; 
double yclose  = iClose(NULL,Chart_Period2,0) ; 

double xdiff   = xclose - xopen ;
double ydiff   = yclose - yopen ;


color HighColor, LowColor, MidColor, Mid1Color, CloseColor, ClOpColor;

if( xdiff > 0 && ydiff > 0 ) { tMessage = Up_Message ; ClOpColor = Up_color ; } else {
if( xdiff < 0 && ydiff < 0 ) { tMessage = Dn_Message ; ClOpColor = Dn_color ; } else {
                               tMessage = Eq_Message ; ClOpColor = Eq_color ; } }  

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


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

   WindowRedraw();    
 

 

   return(0); 
} 

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

 

//+------------------------------------------------------------------+ 
/*

Big number is the current price.

Arrow to the right tells if price is up or down compared to open.

Top Left = high price

Top Right = current midpoint

Bottom Left = low price

Bottom Right = previous midpoint.



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


string Arrow12 = "ñ"; // 12 oclock
string Arrow2  = "ö";  // 2 oclock
string Arrow3  = "ð";  // 3 oclock
string Arrow5  = "ø";  // 5 oclock
string Arrow6  = "ò";  // 6 oclock

//+------------------------------------------------------------------+
color fColor( double i, double j)
{
color rColor ;

    if ( i > j ) rColor = Up_color; 
    else {
    if ( i < j )  rColor = Dn_color; 
    else rColor = Eq_color; }
return ( rColor );
}


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

  if(Chart_Period == 0) { Chart_Period = Period() ; }

string fCompass( double i, double j)
{
string rCompass ;

    if ( i > j ) rCompass = Arrow12 ; 
    else {
    if ( i < j )  rCompass = Arrow6  ; 
    else rCompass = Arrow3 ; }
return ( rCompass );
}


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

HighColor  = fColor( high, high1 ) ;
LowColor   = fColor( low, low1 ) ;
MidColor   = fColor( close, mid ) ;
Mid1Color  = fColor( close, mid1 ) ;
CloseColor = fColor( close, close1 ) ;
ClOpColor  = fColor( close, open ) ;


string CloseDir = fCompass( close, close1 ) ;
string HighDir  = fCompass( high, high1 ) ;
string LowDir   = fCompass( low, low1 ) ;
string MidDir   = fCompass( close, mid ) ;
string Mid1Dir  = fCompass( close, mid1 ) ;
string ClOpDir  = fCompass( close, open ) ;

string tPeriod = " "+TimeFrameToString( Chart_Period ) ;



   ObjectCreate("CAN231", OBJ_LABEL, win, 0, 0);//HiLow LABEL
   ObjectSetText("CAN231", CloseDir , myFontSize, "Wingdings" , CloseColor );
   ObjectSet("CAN231", OBJPROP_CORNER, 0);
   ObjectSet("CAN231", OBJPROP_XDISTANCE, 930+price.x.offset); // 765
   ObjectSet("CAN231", OBJPROP_YDISTANCE, 210+price.y.offset); 
   
   
 string TimeFrameToString(int tf)
{
   string tfs;
   switch(tf) {
      case PERIOD_M1:  tfs="M1"  ; break;
      case PERIOD_M5:  tfs="M5"  ; break;
      case PERIOD_M15: tfs="M15" ; break;
      case PERIOD_M30: tfs="M30" ; break;
      case PERIOD_H1:  tfs="H1"  ; break;
      case PERIOD_H4:  tfs="H4"  ; break;
      case PERIOD_D1:  tfs="D1"  ; break;
      case PERIOD_W1:  tfs="W1"  ; break;
      case PERIOD_MN1: tfs="MN1";
   }
   return(tfs);
}
  
   
*/   