//+------------------------------------------------------------------+ 
//|   tro_price_position                                             | 
//|                                                                  | 
//|   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/" 

#property indicator_chart_window


//---- input parameters 


extern int myChartY = 0 ;

extern int myChartPeriod = 0 ;
extern int myBars        = 24 ;

extern string myFont  = "Courier" ; // "Verdana" Courier
extern int myFontSize = 12 ; //9
 
extern color myColorH = Orange ;
extern color myColor1 = DodgerBlue ;
extern color myColor2 = DodgerBlue ;
extern color myColor3 = DodgerBlue ;
extern color myColor4 = DodgerBlue ;
extern color myColor5 = DodgerBlue ;
extern color myColor6 = DodgerBlue ;
extern color myColor7 = PaleVioletRed ;
extern color myColor8 = PaleVioletRed ;
extern color myColor9 = LightSalmon ;
extern color myColor10 = LightSalmon ;
extern color myColor11 = LightSalmon ;
extern color myColor12 = LightSalmon ;
extern color myColor13 = LightSalmon ;
extern color myColor14 = DarkKhaki ;
extern color myColor15 = DarkKhaki ;
extern color myColor16 = DarkKhaki ;
extern color myColor17 = DarkKhaki ;
extern color myColor18 = Yellow ;
extern color myColor19 = Yellow ;
//---- buffers
 

int i;
   

double X01,X02,X03,X04,X05 ;
double X06 ;   
double X07 ;
double X08, X09, X10,X11,X12, X13,X14,X15,X16, X17,X18, X19 ; 
double xRet, xRetBody, xRetWick, xRetTail ;
double xRetPct, xRetBodyPct, xRetWickPct, xRetTailPct;    
  
string symbol, tChartPeriod ;  
int    digits, period, win ; 
int    Long_Score, Short_Score ;


double point, D1_High0, D1_Low0, D1_Open, D1_High1, D1_Low1, D1_Close1, close  ;  
double H1_High0, H1_Low0, H1_Open, H1_High1, H1_Low1, H1_Close1;  
double W1_High0, W1_Low0, W1_Open, W1_High1, W1_Low1, W1_Close1;  

double  AvgRange, xRange, xBody, xWick, xTail, xTop, xBottom  ;

string dHead01, dHead02;
string dLabel01, dValue01;
string dLabel02, dValue02;
string dLabel03, dValue03;
string dLabel04, dValue04;
string dLabel05, dValue05;
string dLabel06, dValue06;
string dLabel07, dValue07;
string dLabel08, dValue08;
string dLabel09, dValue09;
string dLabel10, dValue10;
string dLabel11, dValue11;
string dLabel12, dValue12;
string dLabel13, dValue13;
string dLabel14, dValue14;
string dLabel15, dValue15;
string dLabel16, dValue16;
string dLabel17, dValue17;
string dLabel18, dValue18;
string dLabel19, dValue19;

//+------------------------------------------------------------------+
  
int init()
  {

   if(myChartPeriod == 0) { myChartPeriod = Period() ; }    
   tChartPeriod =  TimeFrameToString(myChartPeriod) ;
   symbol       =  Symbol() ;
   digits       =  0 ;
   point        =  Point ;
 
   win          = 0 ;
    
 dHead01="rskh01"+ tChartPeriod ;  dHead02="rsk202"+ tChartPeriod ;     
    
 dLabel01="rsk01"+ tChartPeriod ;  dValue01="rskv01"+ tChartPeriod ; 
 dLabel02="rsk02"+ tChartPeriod ;  dValue02="rskv02"+ tChartPeriod ; 
 dLabel03="rsk03"+ tChartPeriod ;  dValue03="rskv03"+ tChartPeriod ; 
 dLabel04="rsk04"+ tChartPeriod ;  dValue04="rskv04"+ tChartPeriod ; 
 dLabel05="rsk05"+ tChartPeriod ;  dValue05="rskv05"+ tChartPeriod ; 
 dLabel06="rsk06"+ tChartPeriod ;  dValue06="rskv06"+ tChartPeriod ; 
 dLabel07="rsk07"+ tChartPeriod ;  dValue07="rskv07"+ tChartPeriod ; 
 dLabel08="rsk08"+ tChartPeriod ;  dValue08="rskv08"+ tChartPeriod ; 
 dLabel09="rsk09"+ tChartPeriod ;  dValue09="rskv09"+ tChartPeriod ; 
 dLabel10="rsk10"+ tChartPeriod ;  dValue10="rskv10"+ tChartPeriod ; 
 dLabel11="rsk11"+ tChartPeriod ;  dValue11="rskv11"+ tChartPeriod ;     
 dLabel12="rsk12"+ tChartPeriod ;  dValue12="rskv12"+ tChartPeriod ;    
 dLabel13="rsk13"+ tChartPeriod ;  dValue13="rskv13"+ tChartPeriod ; 
 dLabel14="rsk14"+ tChartPeriod ;  dValue14="rskv14"+ tChartPeriod ; 
 dLabel15="rsk15"+ tChartPeriod ;  dValue15="rskv15"+ tChartPeriod ;     
 dLabel16="rsk16"+ tChartPeriod ;  dValue16="rskv16"+ tChartPeriod ;    
 dLabel17="rsk17"+ tChartPeriod ;  dValue17="rskv17"+ tChartPeriod ;       
 dLabel18="rsk18"+ tChartPeriod ;  dValue18="rskv18"+ tChartPeriod ;    
 dLabel19="rsk19"+ tChartPeriod ;  dValue19="rskv19"+ tChartPeriod ;  
      
      
   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+

int deinit()
  {
ObjectsDeleteAll( win );
    
   return(0);
  }


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

int start()
{
  
DoShowGauge() ;

return(0); 
} 

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

void DoShowGauge()
{


D1_Open   = iOpen(NULL,1440,0) ; 
D1_High1  = iHigh(NULL,1440,1) ; 
D1_Low1   = iLow(NULL,1440,1) ; 
D1_Close1 = iClose(NULL,1440,1) ;      

D1_High0  = iHigh(NULL,1440,0) ; 
D1_Low0   = iLow(NULL,1440,0) ; 
 
 
H1_Open   = iOpen(NULL,PERIOD_H1,0) ; 
H1_High1  = iHigh(NULL,PERIOD_H1,1) ; 
H1_Low1   = iLow(NULL,PERIOD_H1,1) ; 
H1_Close1 = iClose(NULL,PERIOD_H1,1) ;      
 

W1_Open   = iOpen(NULL,PERIOD_W1,0) ; 
W1_High1  = iHigh(NULL,PERIOD_W1,1) ; 
W1_Low1   = iLow(NULL,PERIOD_W1,1) ; 
W1_Close1 = iClose(NULL,PERIOD_W1,1) ;  
   
close     = Close[0] ;  
  
xRange    = D1_High1 - D1_Low1 ;
   
double jjrvat = iMA(NULL,0,240,0,3,0,0);  
double ema5   = iMA(NULL,0,5,0,1,0,0); 

int BarShift = iBarShift(NULL,60,Time[0],true); 
   
double tunnel1 = iMA(NULL,60,144,0,1,0,BarShift);       
double tunnel2 = iMA(NULL,60,169,0,1,0,BarShift); 

double D1_Mid0 = ( D1_High0 + D1_Low0 ) * 0.50 ;
double D1_Mid1 = ( D1_High1 + D1_Low1 ) * 0.50 ;

double H1_Mid1 = ( H1_High1 + H1_Low1 ) * 0.50 ;
double W1_Mid1 = ( W1_High1 + W1_Low1 ) * 0.50 ;


 
 
X01  = ( close - D1_Open ) / point ;
X02  = ( close - D1_High1 ) / point ;
X03  = ( close - D1_Low1 ) / point ;
X04  = ( close - ( D1_Close1 + D1_High1 + D1_Low1) / 3 ) / point ;
X05  = ( close - D1_Mid1 ) / point ; 
X06  = ( close - D1_Mid0 ) / point ; 
X07  = ( close - jjrvat ) / point ;
X08  = ( close - ema5 ) / point ;
X09  = ( close - ( tunnel1 + tunnel2 ) * 0.50 ) / point ;
X10  = ( close - H1_Open ) / point ;
X11  = ( close - H1_High1 ) / point ;
X12  = ( close - H1_Low1 ) / point ;
X13  = ( close - H1_Mid1 ) / point ;
X14  = ( close - W1_Open ) / point ;
X15  = ( close - W1_High1 ) / point ;
X16  = ( close - W1_Low1 ) / point ;
X17  = ( close - W1_Mid1 ) / point ;


//Comment( "PP= ", DoubleToStr(( D1_Close1 + D1_Open + D1_Low1) / 3 , 4) );


string StrH   = "Price Position" ;
string StrX01 = "CurD Open" ; 
string StrX02 = "PrvD High" ; 
string StrX03 = "PrvD Low " ; 
string StrX04 = "PivotD   " ;  
string StrX05 = "PrvD Mid " ;  
string StrX06 = "CurrD Mid" ;
string StrX07 = tChartPeriod + " jjrvat" ;
string StrX08 = tChartPeriod + " EMA(5)" ;  
string StrX09 = "H1 Tunnel" ;
string StrX10 = "CurH Open" ; 
string StrX11 = "PrvH High" ; 
string StrX12 = "PrvH Low " ; 
string StrX13 = "PrvH Mid " ;
string StrX14 = "CurW Open" ; 
string StrX15 = "PrvW High" ; 
string StrX16 = "PrvW Low " ; 
string StrX17 = "PrvW Mid " ;
string StrX18 = "Long Risk" ; 
string StrX19 = "Shrt Risk" ; 
  
color color_X01=myColor1;
color color_X02=myColor2;
color color_X03=myColor3;  
color color_X04=myColor4;
color color_X05=myColor5;
color color_X06=myColor6;
color color_X07=myColor7;  
color color_X08=myColor8;  
color color_X09=myColor9;   
color color_X10=myColor10; 
color color_X11=myColor11; 
color color_X12=myColor12; 
color color_X13=myColor13; 
color color_X14=myColor14; 
color color_X15=myColor15; 
color color_X16=myColor16; 
color color_X17=myColor17; 
color color_X18=myColor18; 
color color_X19=myColor19; 



Long_Score  = 0 ; 
Short_Score = 0 ;  
// 1 = "CurD Open"  
if( X01 > 0 ) { color_X01 = Lime ; Short_Score  = Short_Score + 1 ; } else { color_X01 = Red ; Long_Score  = Long_Score + 1 ;  } 

// 2 = "PrvD High" 
if( X02 > 0 ) { color_X02 = Lime ;  Long_Score  = Long_Score + 1 ; } else { color_X02 = Red ; } 

// 3 = "PrvD Low "  
if( X03 > 0 ) { color_X03 = Lime ; } else { color_X03 = Red ; Short_Score  = Short_Score + 1 ; } 

// 4 = "PivotD   "   
if( X04 > 0 ) { color_X04 = Lime ; Short_Score  = Short_Score + 1 ; } else { color_X04 = Red ; Long_Score  = Long_Score + 1 ;  } 

// 5 = "PrvD Mid " 
if( X05 > 0 ) { color_X05 = Lime ; Short_Score  = Short_Score + 1 ; } else { color_X05 = Red ; Long_Score  = Long_Score + 1 ; } 

// 6 = "CurrD Mid" 
if( X06 > 0 ) { color_X06 = Lime ; Short_Score  = Short_Score + 1 ; } else { color_X06 = Red ; Long_Score  = Long_Score + 1 ; }

// 7 = tChartPeriod + " jjrvat"
if( X07 > 0 ) { color_X07 = Lime ; Short_Score  = Short_Score + 1 ;  } else { color_X07 = Red ; Long_Score  = Long_Score + 1 ;  }    

// 8 = tChartPeriod + " EMA(5)"
if( X08 > 0 ) { color_X08 = Lime ; Short_Score  = Short_Score + 1 ; } else { color_X08 = Red ; Long_Score  = Long_Score + 1 ; } 

// 9 = "H1 Tunnel" 
if( X09 > 0 ) { color_X09 = Lime ; Short_Score  = Short_Score + 1 ; } else { color_X09 = Red ; Long_Score  = Long_Score + 1 ;  }

// 10 = "CurH Open" 
if( X10 > 0 ) { color_X10 = Lime ;   Short_Score  = Short_Score + 1 ; } else { color_X10 = Red ;  Long_Score  = Long_Score + 1 ;}  	

// 11 = "PrvH High"  
if( X11 > 0 ) { color_X11 = Lime ; Long_Score  = Long_Score + 1 ; } else { color_X11 = Red ; }  

// 12 = "PrvH Low "
if( X12 > 0 ) { color_X12 = Lime ; } else { color_X12 = Red ;  Short_Score  = Short_Score + 1 ;  }  

// 13 = "PrvH Mid " 
if( X13 > 0 ) { color_X13 = Lime ; Short_Score  = Short_Score + 1 ; } else { color_X13 = Red ; Long_Score  = Long_Score + 1 ;  }       	

// 14 = "CurW Open"
if( X14 > 0 ) { color_X14 = Lime ;  Short_Score  = Short_Score + 1 ; } else { color_X14 = Red ;  Long_Score  = Long_Score + 1 ; }  	

// 15 = "PrvW High" 
if( X15 > 0 ) { color_X15 = Lime ;  Long_Score  = Long_Score + 1 ; } else { color_X15 = Red ; }  

// 16 = "PrvW Low "  
if( X16 > 0 ) { color_X16 = Lime ; } else { color_X16 = Red ; Short_Score  = Short_Score + 1 ; }  

// 17 = "PrvW Mid " 
if( X17 > 0 ) { color_X17 = Lime ; Short_Score  = Short_Score + 1 ; } else { color_X17 = Red ; Long_Score  = Long_Score + 1 ; }       	

X18  = Long_Score ;
X19  = Short_Score ;  
     	
// 18 = "Long Risk" 
// 19 = "Shrt Risk"   
if( X18 > X19 ) { color_X18 = Lime ;  color_X19 = Red ; } else { color_X19 = Lime ;  color_X18 = Red ; }      	
     	
//---- Set Pivots labels

   int WindowToUse;
   int Corner_line, Xdist_line;
   int Corner_text, Corner_vSRFP, Xdist_text, Xdist_vSRFP;
   int Ydist_line5;
   int Corner_pivots, Xdist_pivots, Ydist_pivots;
   int Ydist_X01, Ydist_X02, Ydist_X03, Ydist_X04, Ydist_X05, Ydist_X06, Ydist_X07, Ydist_X08, Ydist_X09, Ydist_X10 ;
   int Ydist_X11, Ydist_X12, Ydist_X13,Ydist_X14, Ydist_X15, Ydist_X16, Ydist_X17, Ydist_X18, Ydist_X19  ;  
   int YdistInc ;
   
    WindowToUse =  0;
    Corner_line = 1;
    Corner_text = 1; Corner_vSRFP = 1;
    Xdist_line = 21; Xdist_text = 63; Xdist_vSRFP = 23;
    Corner_pivots = 1; Xdist_pivots = 21; 
    
    Ydist_pivots = myChartY;  
    Ydist_line5 = Ydist_pivots + 11; YdistInc = 15 ;
    
    Ydist_X01 = Ydist_pivots + 25; 
    Ydist_X02 = Ydist_X01 + YdistInc; 
    Ydist_X03 = Ydist_X01 + YdistInc*2; 
    Ydist_X04 = Ydist_X01 + YdistInc*3; 
    Ydist_X05 = Ydist_X01 + YdistInc*4;
    Ydist_X06 = Ydist_X01 + YdistInc*5;    
    Ydist_X07 = Ydist_X01 + YdistInc*6;
    Ydist_X08 = Ydist_X01 + YdistInc*7;    
    Ydist_X09 = Ydist_X01 + YdistInc*8;    
    Ydist_X10 = Ydist_X01 + YdistInc*9;    
    Ydist_X11 = Ydist_X01 + YdistInc*10; 
    Ydist_X12 = Ydist_X01 + YdistInc*11;     
    Ydist_X13 = Ydist_X01 + YdistInc*12;     
    Ydist_X14 = Ydist_X01 + YdistInc*13; 
    Ydist_X15 = Ydist_X01 + YdistInc*14;     
    Ydist_X16 = Ydist_X01 + YdistInc*15;  
    Ydist_X17 = Ydist_X01 + YdistInc*16;     
    Ydist_X18 = Ydist_X01 + YdistInc*17;  
    Ydist_X19 = Ydist_X01 + YdistInc*18;
        
//+------------------------------------------------------------------+ 
   ObjectCreate(dHead01, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dHead01,StrH,myFontSize, myFont, myColorH);
   ObjectSet(dHead01, OBJPROP_CORNER, Corner_pivots);
   ObjectSet(dHead01, OBJPROP_XDISTANCE, Xdist_pivots);
   ObjectSet(dHead01, OBJPROP_YDISTANCE, Ydist_pivots);
   
   ObjectCreate(dHead02, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dHead02,"--------------",myFontSize, myFont, myColorH);
   ObjectSet(dHead02, OBJPROP_CORNER, Corner_line);
   ObjectSet(dHead02, OBJPROP_XDISTANCE, Xdist_line);
   ObjectSet(dHead02, OBJPROP_YDISTANCE, Ydist_line5);

//+------------------------------------------------------------------+    
   ObjectCreate(dLabel01, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dLabel01,StrX01,myFontSize, myFont, myColor1 );
   ObjectSet(dLabel01, OBJPROP_CORNER, Corner_text);
   ObjectSet(dLabel01, OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet(dLabel01, OBJPROP_YDISTANCE, Ydist_X01);
   
   ObjectCreate(dValue01, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dValue01," "+DoubleToStr(X01,digits),myFontSize, myFont, color_X01);
   ObjectSet(dValue01, OBJPROP_CORNER, Corner_vSRFP);
   ObjectSet(dValue01, OBJPROP_XDISTANCE, Xdist_vSRFP);
   ObjectSet(dValue01, OBJPROP_YDISTANCE, Ydist_X01);

//+------------------------------------------------------------------+     
   ObjectCreate(dLabel02, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dLabel02,StrX02,myFontSize, myFont, myColor2 );
   ObjectSet(dLabel02, OBJPROP_CORNER, Corner_text);
   ObjectSet(dLabel02, OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet(dLabel02, OBJPROP_YDISTANCE, Ydist_X02);
   
   ObjectCreate(dValue02, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dValue02," "+DoubleToStr(X02,digits),myFontSize, myFont, color_X02);
   ObjectSet(dValue02, OBJPROP_CORNER, Corner_vSRFP);
   ObjectSet(dValue02, OBJPROP_XDISTANCE, Xdist_vSRFP);
   ObjectSet(dValue02, OBJPROP_YDISTANCE, Ydist_X02);

//+------------------------------------------------------------------+ 
   ObjectCreate(dLabel03, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dLabel03,StrX03,myFontSize, myFont, myColor3 );
   ObjectSet(dLabel03, OBJPROP_CORNER, Corner_text);
   ObjectSet(dLabel03, OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet(dLabel03, OBJPROP_YDISTANCE, Ydist_X03);
   
   ObjectCreate(dValue03, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dValue03," "+DoubleToStr(X03,digits),myFontSize, myFont, color_X03);
   ObjectSet(dValue03, OBJPROP_CORNER, Corner_vSRFP);
   ObjectSet(dValue03, OBJPROP_XDISTANCE, Xdist_vSRFP);
   ObjectSet(dValue03, OBJPROP_YDISTANCE, Ydist_X03);

//+------------------------------------------------------------------+ 
   ObjectCreate(dLabel04, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dLabel04,StrX04,myFontSize, myFont, myColor4 );
   ObjectSet(dLabel04, OBJPROP_CORNER, Corner_text);
   ObjectSet(dLabel04, OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet(dLabel04, OBJPROP_YDISTANCE, Ydist_X04);
   
   ObjectCreate(dValue04, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dValue04," "+DoubleToStr(X04,digits),myFontSize, myFont, color_X04);
   ObjectSet(dValue04, OBJPROP_CORNER, Corner_vSRFP);
   ObjectSet(dValue04, OBJPROP_XDISTANCE, Xdist_vSRFP);
   ObjectSet(dValue04, OBJPROP_YDISTANCE, Ydist_X04);  

//+------------------------------------------------------------------+    
   ObjectCreate(dLabel05, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dLabel05,StrX05,myFontSize, myFont, myColor5 );
   ObjectSet(dLabel05, OBJPROP_CORNER, Corner_text);
   ObjectSet(dLabel05, OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet(dLabel05, OBJPROP_YDISTANCE, Ydist_X05);
   
   ObjectCreate(dValue05, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dValue05," "+DoubleToStr(X05,digits),myFontSize, myFont, color_X05);
   ObjectSet(dValue05, OBJPROP_CORNER, Corner_vSRFP);
   ObjectSet(dValue05, OBJPROP_XDISTANCE, Xdist_vSRFP);
   ObjectSet(dValue05, OBJPROP_YDISTANCE, Ydist_X05);

//+------------------------------------------------------------------+     
   ObjectCreate(dLabel06, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dLabel06,StrX06,myFontSize, myFont, myColor6 );
   ObjectSet(dLabel06, OBJPROP_CORNER, Corner_text);
   ObjectSet(dLabel06, OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet(dLabel06, OBJPROP_YDISTANCE, Ydist_X06);
   
   ObjectCreate(dValue06, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dValue06," "+DoubleToStr(X06,digits),myFontSize, myFont, color_X06);
   ObjectSet(dValue06, OBJPROP_CORNER, Corner_vSRFP);
   ObjectSet(dValue06, OBJPROP_XDISTANCE, Xdist_vSRFP);
   ObjectSet(dValue06, OBJPROP_YDISTANCE, Ydist_X06);

   ObjectCreate(dLabel07, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dLabel07,StrX07,myFontSize, myFont, myColor7 );
   ObjectSet(dLabel07, OBJPROP_CORNER, Corner_text);
   ObjectSet(dLabel07, OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet(dLabel07, OBJPROP_YDISTANCE, Ydist_X07);
   
   ObjectCreate(dValue07, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dValue07," "+DoubleToStr(X07,digits),myFontSize, myFont, color_X07);
   ObjectSet(dValue07, OBJPROP_CORNER, Corner_vSRFP);
   ObjectSet(dValue07, OBJPROP_XDISTANCE, Xdist_vSRFP);
   ObjectSet(dValue07, OBJPROP_YDISTANCE, Ydist_X07);

   ObjectCreate(dLabel08, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dLabel08,StrX08,myFontSize, myFont, myColor8 );
   ObjectSet(dLabel08, OBJPROP_CORNER, Corner_text);
   ObjectSet(dLabel08, OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet(dLabel08, OBJPROP_YDISTANCE, Ydist_X08);
   
   ObjectCreate(dValue08, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dValue08," "+DoubleToStr(X08,digits),myFontSize, myFont, color_X08);
   ObjectSet(dValue08, OBJPROP_CORNER, Corner_vSRFP);
   ObjectSet(dValue08, OBJPROP_XDISTANCE, Xdist_vSRFP);
   ObjectSet(dValue08, OBJPROP_YDISTANCE, Ydist_X08);  
  
   ObjectCreate(dLabel09, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dLabel09,StrX09,myFontSize, myFont, myColor9 );
   ObjectSet(dLabel09, OBJPROP_CORNER, Corner_text);
   ObjectSet(dLabel09, OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet(dLabel09, OBJPROP_YDISTANCE, Ydist_X09);
   
   ObjectCreate(dValue09, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dValue09," "+DoubleToStr(X09,digits),myFontSize, myFont, color_X09);
   ObjectSet(dValue09, OBJPROP_CORNER, Corner_vSRFP);
   ObjectSet(dValue09, OBJPROP_XDISTANCE, Xdist_vSRFP);
   ObjectSet(dValue09, OBJPROP_YDISTANCE, Ydist_X09);  
   
   
   ObjectCreate(dLabel10, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dLabel10,StrX10,myFontSize, myFont, myColor10 );
   ObjectSet(dLabel10, OBJPROP_CORNER, Corner_text);
   ObjectSet(dLabel10, OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet(dLabel10, OBJPROP_YDISTANCE, Ydist_X10);
   
   ObjectCreate(dValue10, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dValue10," "+DoubleToStr(X10,digits),myFontSize, myFont, color_X10);
   ObjectSet(dValue10, OBJPROP_CORNER, Corner_vSRFP);
   ObjectSet(dValue10, OBJPROP_XDISTANCE, Xdist_vSRFP);
   ObjectSet(dValue10, OBJPROP_YDISTANCE, Ydist_X10);  
 
   ObjectCreate(dLabel11, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dLabel11,StrX11,myFontSize, myFont, myColor11 );
   ObjectSet(dLabel11, OBJPROP_CORNER, Corner_text);
   ObjectSet(dLabel11, OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet(dLabel11, OBJPROP_YDISTANCE, Ydist_X11);
   
   ObjectCreate(dValue11, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dValue11," "+DoubleToStr(X11,digits),myFontSize, myFont, color_X11);
   ObjectSet(dValue11, OBJPROP_CORNER, Corner_vSRFP);
   ObjectSet(dValue11, OBJPROP_XDISTANCE, Xdist_vSRFP);
   ObjectSet(dValue11, OBJPROP_YDISTANCE, Ydist_X11);     
   
   ObjectCreate(dLabel12, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dLabel12,StrX12,myFontSize, myFont, myColor12 );
   ObjectSet(dLabel12, OBJPROP_CORNER, Corner_text);
   ObjectSet(dLabel12, OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet(dLabel12, OBJPROP_YDISTANCE, Ydist_X12);
   
   ObjectCreate(dValue12, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dValue12," "+DoubleToStr(X12,digits),myFontSize, myFont, color_X12);
   ObjectSet(dValue12, OBJPROP_CORNER, Corner_vSRFP);
   ObjectSet(dValue12, OBJPROP_XDISTANCE, Xdist_vSRFP);
   ObjectSet(dValue12, OBJPROP_YDISTANCE, Ydist_X12);     


   ObjectCreate(dLabel13, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dLabel13,StrX13,myFontSize, myFont, myColor13 );
   ObjectSet(dLabel13, OBJPROP_CORNER, Corner_text);
   ObjectSet(dLabel13, OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet(dLabel13, OBJPROP_YDISTANCE, Ydist_X13);
   
   ObjectCreate(dValue13, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dValue13," "+DoubleToStr(X13,digits),myFontSize, myFont, color_X13);
   ObjectSet(dValue13, OBJPROP_CORNER, Corner_vSRFP);
   ObjectSet(dValue13, OBJPROP_XDISTANCE, Xdist_vSRFP);
   ObjectSet(dValue13, OBJPROP_YDISTANCE, Ydist_X13);  

   ObjectCreate(dLabel14, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dLabel14,StrX14,myFontSize, myFont, myColor14 );
   ObjectSet(dLabel14, OBJPROP_CORNER, Corner_text);
   ObjectSet(dLabel14, OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet(dLabel14, OBJPROP_YDISTANCE, Ydist_X14);
   
   ObjectCreate(dValue14, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dValue14," "+DoubleToStr(X14,digits),myFontSize, myFont, color_X14);
   ObjectSet(dValue14, OBJPROP_CORNER, Corner_vSRFP);
   ObjectSet(dValue14, OBJPROP_XDISTANCE, Xdist_vSRFP);
   ObjectSet(dValue14, OBJPROP_YDISTANCE, Ydist_X14);  
 

   ObjectCreate(dLabel15, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dLabel15,StrX15,myFontSize, myFont, myColor15 );
   ObjectSet(dLabel15, OBJPROP_CORNER, Corner_text);
   ObjectSet(dLabel15, OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet(dLabel15, OBJPROP_YDISTANCE, Ydist_X15);
   
   ObjectCreate(dValue15, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dValue15," "+DoubleToStr(X15,digits),myFontSize, myFont, color_X15);
   ObjectSet(dValue15, OBJPROP_CORNER, Corner_vSRFP);
   ObjectSet(dValue15, OBJPROP_XDISTANCE, Xdist_vSRFP);
   ObjectSet(dValue15, OBJPROP_YDISTANCE, Ydist_X15);  


   ObjectCreate(dLabel16, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dLabel16,StrX16,myFontSize, myFont, myColor16 );
   ObjectSet(dLabel16, OBJPROP_CORNER, Corner_text);
   ObjectSet(dLabel16, OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet(dLabel16, OBJPROP_YDISTANCE, Ydist_X16);
   
   ObjectCreate(dValue16, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dValue16," "+DoubleToStr(X16,digits),myFontSize, myFont, color_X16);
   ObjectSet(dValue16, OBJPROP_CORNER, Corner_vSRFP);
   ObjectSet(dValue16, OBJPROP_XDISTANCE, Xdist_vSRFP);
   ObjectSet(dValue16, OBJPROP_YDISTANCE, Ydist_X16);  


   ObjectCreate(dLabel17, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dLabel17,StrX17,myFontSize, myFont, myColor17 );
   ObjectSet(dLabel17, OBJPROP_CORNER, Corner_text);
   ObjectSet(dLabel17, OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet(dLabel17, OBJPROP_YDISTANCE, Ydist_X17);
   
   ObjectCreate(dValue17, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dValue17," "+DoubleToStr(X17,digits),myFontSize, myFont, color_X17);
   ObjectSet(dValue17, OBJPROP_CORNER, Corner_vSRFP);
   ObjectSet(dValue17, OBJPROP_XDISTANCE, Xdist_vSRFP);
   ObjectSet(dValue17, OBJPROP_YDISTANCE, Ydist_X17);  


   ObjectCreate(dLabel18, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dLabel18,StrX18,myFontSize, myFont, myColor18 );
   ObjectSet(dLabel18, OBJPROP_CORNER, Corner_text);
   ObjectSet(dLabel18, OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet(dLabel18, OBJPROP_YDISTANCE, Ydist_X18);
   
   ObjectCreate(dValue18, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dValue18," "+DoubleToStr(X18,digits),myFontSize, myFont, color_X18);
   ObjectSet(dValue18, OBJPROP_CORNER, Corner_vSRFP);
   ObjectSet(dValue18, OBJPROP_XDISTANCE, Xdist_vSRFP);
   ObjectSet(dValue18, OBJPROP_YDISTANCE, Ydist_X18);  


   ObjectCreate(dLabel19, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dLabel19,StrX19,myFontSize, myFont, myColor19 );
   ObjectSet(dLabel19, OBJPROP_CORNER, Corner_text);
   ObjectSet(dLabel19, OBJPROP_XDISTANCE, Xdist_text);
   ObjectSet(dLabel19, OBJPROP_YDISTANCE, Ydist_X19);
   
   ObjectCreate(dValue19, OBJ_LABEL, WindowToUse, 0, 0);
   ObjectSetText(dValue19," "+DoubleToStr(X19,digits),myFontSize, myFont, color_X19);
   ObjectSet(dValue19, OBJPROP_CORNER, Corner_vSRFP);
   ObjectSet(dValue19, OBJPROP_XDISTANCE, Xdist_vSRFP);
   ObjectSet(dValue19, OBJPROP_YDISTANCE, Ydist_X19);   
   
}

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

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="MN";
   }
   return(tfs);
}

/*


TRO RANGE GAUGE displays range information.


Open is candle's D1_Open price.  Green if above previous candle's D1_Open price, red if beD1_Low1.

High is candle's D1_High1 price.  Green if above previous candle's D1_High1 price, red if beD1_Low1.

Low is candle's D1_Low1 price.  Green if above previous candle's D1_Low1 price, red if beD1_Low1.

Close is candle's D1_Close1 price.  Green if above previous candle's D1_Close1 price, red if beD1_Low1.

Range is today's range.  Green if above yesterday's range, red if bD1_Low1.

Ret% is retrace percentage off today's D1_Low1.

Wick% is the wick (D1_High1 - candle top) percentage of the range.

Body% is the candle body (candle top - candle bottom) percentage of the range.

Tail% is the tail (candle bottom - D1_Low1) percentage of the range.

Avg(x) is the average range over the last X bars.  Green is above today's range, red if beD1_Low1.

*/