//+------------------------------------------------------------------+ 
//|   tro_trendcounter                                               | 
//|                                                                  | 
//|   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
#property indicator_buffers 4

//---- input parameters 


extern int myChartY = 500 ;

extern int myChartPeriod = 0 ;
extern int myBars        = 100 ;

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 ;

//---- buffers
 

int i;
   

double X01,X02,X03,X04,X05 ;
double X06 ;   
double X07 ;
double X08, X09, X10,X11,X12, X13,X14,X15,X16, X17 ; 
double xRet, xRetBody, xRetWick, xRetTail ;
double xRetPct, xRetBodyPct, xRetWickPct, xRetTailPct;    
  
string symbol, tChartPeriod ;  
int    digits, period, win ; 
double point, High0, Low0, Open0,  Close0, Open1,High1, Low1, 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  ;



double     ind_bufferOp[];
double     xTrendOp[];
double     xCountOp;
double     ind_bufferHi[];
double     xTrendHi[];
double     xCountHi; 
double     ind_bufferLo[];
double     xTrendLo[];
double     xCountLo; 

double     ind_bufferCl[];
double     xTrendCl[];
double     xCountCl; 


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;
//+------------------------------------------------------------------+
  
int init()
  {

   if(myChartPeriod == 0) { myChartPeriod = Period() ; }    
   tChartPeriod =  TimeFrameToString(myChartPeriod) ;
   symbol       =  Symbol() ;
   digits       =  0 ;
   point        =  Point ;
 
   win          = 0 ;
    
 dHead01="tcnh01"+ tChartPeriod ;  dHead02="tcn202"+ tChartPeriod ;     
    
 dLabel01="tcn01"+ tChartPeriod ;  dValue01="tcnv01"+ tChartPeriod ; 
 dLabel02="tcn02"+ tChartPeriod ;  dValue02="tcnv02"+ tChartPeriod ; 
 dLabel03="tcn03"+ tChartPeriod ;  dValue03="tcnv03"+ tChartPeriod ; 
 dLabel04="tcn04"+ tChartPeriod ;  dValue04="tcnv04"+ tChartPeriod ; 
 dLabel05="tcn05"+ tChartPeriod ;  dValue05="tcnv05"+ tChartPeriod ; 
 dLabel06="tcn06"+ tChartPeriod ;  dValue06="tcnv06"+ tChartPeriod ; 
 dLabel07="tcn07"+ tChartPeriod ;  dValue07="tcnv07"+ tChartPeriod ; 
 dLabel08="tcn08"+ tChartPeriod ;  dValue08="tcnv08"+ tChartPeriod ; 
 dLabel09="tcn09"+ tChartPeriod ;  dValue09="tcnv09"+ tChartPeriod ; 
 dLabel10="tcn10"+ tChartPeriod ;  dValue10="tcnv10"+ tChartPeriod ; 
 dLabel11="tcn11"+ tChartPeriod ;  dValue11="tcnv11"+ tChartPeriod ;     
 dLabel12="tcn12"+ tChartPeriod ;  dValue12="tcnv12"+ tChartPeriod ;    
 dLabel13="tcn13"+ tChartPeriod ;  dValue13="tcnv13"+ tChartPeriod ; 
 dLabel14="tcn14"+ tChartPeriod ;  dValue14="tcnv14"+ tChartPeriod ; 
 dLabel15="tcn15"+ tChartPeriod ;  dValue15="tcnv15"+ tChartPeriod ;     
 dLabel16="tcn16"+ tChartPeriod ;  dValue16="tcnv16"+ tChartPeriod ;    
 dLabel17="tcn17"+ tChartPeriod ;  dValue17="tcnv17"+ tChartPeriod ;       
      
   SetIndexStyle(0,DRAW_LINE);
   SetIndexDrawBegin(0,ind_bufferOp); 
   SetIndexBuffer(0,ind_bufferOp) ;
   
   SetIndexStyle(1,DRAW_LINE);
   SetIndexDrawBegin(1,ind_bufferHi); 
   SetIndexBuffer(1,ind_bufferHi) ;


   SetIndexStyle(2,DRAW_LINE);
   SetIndexDrawBegin(2,ind_bufferLo); 
   SetIndexBuffer(2,ind_bufferLo) ;
   

   SetIndexStyle(3,DRAW_LINE);
   SetIndexDrawBegin(3,ind_bufferCl); 
   SetIndexBuffer(3,ind_bufferCl) ;
   
            
   return(0);
  }

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

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


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

int start()
{
  
DoShowGauge() ;

return(0); 
} 

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

void DoShowGauge()
{

 
   
   int limit;
   int counted_bars=IndicatorCounted();
   
//---- check for possible errors

   if(counted_bars<0) return(-1);
   
//---- last counted bar will be recounted

   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;

   for(int i=myBars; i >= 0; i--) // initialize buffers to 0
   {  
      ind_bufferOp[i] = 0 ; 
      ind_bufferHi[i] = 0 ; 
      ind_bufferLo[i] = 0 ;       
      ind_bufferCl[i] = 0 ;               
   } 

     
   for( i=myBars; i >= 0; i--)
   {
   
      Open0  = iOpen(NULL,myChartPeriod,i) ;
      Open1  = iOpen(NULL,myChartPeriod,i+1) ;
      High0  = iHigh(NULL,myChartPeriod,i) ;
      High1  = iHigh(NULL,myChartPeriod,i+1) ;
      Low0   = iLow(NULL,myChartPeriod,i) ;
      Low1   = iLow(NULL,myChartPeriod,i+1) ;
      Close0  = iClose(NULL,myChartPeriod,i) ;
      Close1  = iClose(NULL,myChartPeriod,i+1) ;

   
      if(Open0 > Open1) { if(ind_bufferOp[i+1] <= 0) {ind_bufferOp[i] = 1;  } else { ind_bufferOp[i] =  ind_bufferOp[i+1] + 1 ; } }
      if(Open0 < Open1) { if(ind_bufferOp[i+1] >= 0) {ind_bufferOp[i] = -1;  } else { ind_bufferOp[i] =  ind_bufferOp[i+1] - 1 ; } }

      if(High0 > High1) { if(ind_bufferHi[i+1] <= 0) {ind_bufferHi[i] = 1;  } else { ind_bufferHi[i] =  ind_bufferHi[i+1] + 1 ; } }
      if(High0 < High1) { if(ind_bufferHi[i+1] >= 0) {ind_bufferHi[i] = -1;  } else { ind_bufferHi[i] =  ind_bufferHi[i+1] - 1 ; } }

      if(Low0 > Low1) { if(ind_bufferLo[i+1] <= 0) {ind_bufferLo[i] = 1;  } else { ind_bufferLo[i] = ind_bufferLo[i+1] + 1 ; } }
      if(Low0 < Low1) { if(ind_bufferLo[i+1] >= 0) {ind_bufferLo[i] = -1; } else { ind_bufferLo[i] = ind_bufferLo[i+1] - 1 ; } }

      if(Close0 > Close1) { if(ind_bufferCl[i+1] <= 0) {ind_bufferCl[i] = 1;  } else { ind_bufferCl[i] = ind_bufferCl[i+1] + 1 ; } }
      if(Close0 < Close1) { if(ind_bufferCl[i+1] >= 0) {ind_bufferCl[i] = -1; } else { ind_bufferCl[i] = ind_bufferCl[i+1] - 1 ; } }
                   
   } 


X01  = ind_bufferOp[0] ;
X02  = ind_bufferHi[0] ;
X03  = ind_bufferLo[0] ;
X04  = ind_bufferCl[0] ; 
X05  = 0; 
X06  = 0; 
X07  = 0 ;
X08  = 0 ;
X09  = 0 ;
X10  = 0 ;
X11  = 0 ;
X12  = 0 ;
X13  = 0 ;
X14  = 0 ;
X15  = 0 ;
X16  = 0 ;
X17  = 0 ;

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


string StrH   = tChartPeriod + " Trend " ;
string StrX01 = "Open " ; 
string StrX02 = "High " ; 
string StrX03 = "Low  " ; 
string StrX04 = "Close" ;  
string StrX05 = " " ;  
string StrX06 = "CurrD Mid" ;
string StrX07 = "jjrvat   " ;
string StrX08 = "EMA(5)   " ;  
string StrX09 = "H1Tunnel " ;
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 " ;
  
  
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; 




if( X01 > 0 ) { color_X01 = Lime ; } else { color_X01 = Red ; } 
if( X02 > 0 ) { color_X02 = Lime ; } else { color_X02 = Red ; } 
if( X03 > 0 ) { color_X03 = Lime ; } else { color_X03 = Red ; }   
if( X04 > 0 ) { color_X04 = Lime ; } else { color_X04 = Red ; } 
if( X05 > 0 ) { color_X05 = Lime ; } else { color_X05 = Red ; } 
if( X06 > 0 ) { color_X06 = Lime ; } else { color_X06 = Red ; }
if( X07 > 0 ) { color_X07 = Lime ; } else { color_X07 = Red ; }    
if( X08 > 0 ) { color_X08 = Lime ; } else { color_X08 = Red ; } 
if( X09 > 0 ) { color_X09 = Lime ; } else { color_X09 = Red ; }
if( X10 > 0 ) { color_X10 = Lime ; } else { color_X10 = Red ; }  	
if( X11 > 0 ) { color_X11 = Lime ; } else { color_X11 = Red ; }  
if( X12 > 0 ) { color_X12 = Lime ; } else { color_X12 = Red ; }  
if( X13 > 0 ) { color_X13 = Lime ; } else { color_X13 = Red ; }       	
if( X14 > 0 ) { color_X14 = Lime ; } else { color_X14 = Red ; }  	
if( X15 > 0 ) { color_X15 = Lime ; } else { color_X15 = Red ; }  
if( X16 > 0 ) { color_X16 = Lime ; } else { color_X16 = Red ; }  
if( X17 > 0 ) { color_X17 = Lime ; } else { color_X17 = 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  ;  
   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;     
    
//+------------------------------------------------------------------+ 
   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);  
 
*/
 
}

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

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);
}

