//+------------------------------------------------------------------+ 
//|   cm_RANGE_GAUGE_WEEK                                            | 
//|                                                                  | 
//|   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 = 100 ;

extern int myChartPeriod       = PERIOD_W1 ;
extern int myChartPeriodOffset = 1 ;
extern int myBars              = 24 ;

extern string myFont  = "Courier" ; // "Verdana"
extern int myFontSize = 12 ; //9
 
extern color myColorH = LightSteelBlue ;
extern color myColor1 = LightSteelBlue ;
extern color myColor2 = LightSteelBlue ;
extern color myColor3 = LightSteelBlue ;
extern color myColor4 = LightSteelBlue ;
extern color myColor5 = LightSteelBlue ;
extern color myColor6 = LightSteelBlue ;
extern color myColor7 = LightSteelBlue ;
extern color myColor8 = LightSteelBlue ;
extern color myColor9 = LightSteelBlue ;
extern color myColor10 = LightSteelBlue ;
extern color myColor11 = LightSteelBlue ;
extern color myColor12 = LightSteelBlue ;
extern color myColor13 = LightSteelBlue ;

//---- buffers
 

int i;
   

double X01,X02,X03,X04,X05 ;
double X06 ;   
double X07 ;
double X08, X09, X10, X11, X12, X13; 
double xRet, xRetBody, xRetWick, xRetTail, HiOp, OpLo, ClOp ;
double xRetPct, xRetBodyPct, xRetWickPct, xRetTailPct;    
  
string symbol, tChartPeriod ;  
int    digits, period, win ; 
double point, open, high, low, close ;  

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;


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

   if(myChartPeriod == 0) { myChartPeriod = Period() ; }    
   tChartPeriod =  TimeFrameToString(myChartPeriod) ;
   symbol       =  Symbol() ;
   digits       =  Digits ;
   point        =  Point ;
 
   win          = 0 ;
    
 dHead01="wkrh01"+ tChartPeriod ;  dHead02="wkr202"+ tChartPeriod ;     
    
 dLabel01="wkr01"+ tChartPeriod ;  dValue01="wkrv01"+ tChartPeriod ; 
 dLabel02="wkr02"+ tChartPeriod ;  dValue02="wkrv02"+ tChartPeriod ; 
 dLabel03="wkr03"+ tChartPeriod ;  dValue03="wkrv03"+ tChartPeriod ; 
 dLabel04="wkr04"+ tChartPeriod ;  dValue04="wkrv04"+ tChartPeriod ; 
 dLabel05="wkr05"+ tChartPeriod ;  dValue05="wkrv05"+ tChartPeriod ; 
 dLabel06="wkr06"+ tChartPeriod ;  dValue06="wkrv06"+ tChartPeriod ; 
 dLabel07="wkr07"+ tChartPeriod ;  dValue07="wkrv07"+ tChartPeriod ; 
 dLabel08="wkr08"+ tChartPeriod ;  dValue08="wkrv08"+ tChartPeriod ; 
 dLabel09="wkr09"+ tChartPeriod ;  dValue09="wkrv09"+ tChartPeriod ; 
 dLabel10="wkr10"+ tChartPeriod ;  dValue10="wkrv10"+ tChartPeriod ; 
 dLabel11="wkr11"+ tChartPeriod ;  dValue11="wkrv11"+ tChartPeriod ;     
 dLabel12="wkr12"+ tChartPeriod ;  dValue12="wkrv12"+ tChartPeriod ;    
 dLabel13="wkr13"+ tChartPeriod ;  dValue13="wkrv13"+ tChartPeriod ;     
 
    
   return(0);
  }

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

int deinit()
  {

ObjectsDeleteAll(win);     
   return(0);
  }


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

int start()
{
  
open  = iOpen(NULL,myChartPeriod,myChartPeriodOffset) ; 
high  = iHigh(NULL,myChartPeriod,myChartPeriodOffset) ; 
low   = iLow(NULL,myChartPeriod,myChartPeriodOffset) ; 
close = iClose(NULL,myChartPeriod,myChartPeriodOffset) ;      
  
xRange = high - low ;
 
HiOp = high - open ; 
OpLo = open - low ; 
ClOp = close - open ;   

xTop    = MathMax(close,open) ;  
xBottom = MathMin(close,open) ;  
  
xRet    = (Close[0] - low) ;
xRetPct = ( 100 * xRet ) / ( xRange );  
  
/*
xRetWick    = high - xTop ;
xRetWickPct = ( 100 * xRetWick ) / ( xRange );   
       
xRetTail    = xBottom - low ;
xRetTailPct = ( 100 * xRetTail ) / ( xRange );   

xRetBody    = MathAbs(close - open) ;
xRetBodyPct = ( 100 * xRetBody ) / ( xRange );    
*/

int limit = myBars + 1;

   for(int i=1; i<limit; i++) 
   { 

     double HighVal  = iHigh(NULL,myChartPeriod,i);        
     double LowVal   = iLow(NULL,myChartPeriod,i); 

     double Range    = HighVal - LowVal ; // range

     double tRange   = Range / point; // range
     
     double buf_tmp  =  buf_tmp + Range ;
          
   } 

     AvgRange = buf_tmp / myBars / point ; // average range 



DoShowGauge() ;

return(0); 
} 

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

void DoShowGauge()
{

X01  = open ;
X02  = high ;
X03  = low ;
X04  = close ;
X05  = xRange / point;
X06  = xRetPct  ;
X07  = xRetWickPct  ;
X08  = xRetBodyPct ;
X09  = xRetTailPct ;
X10  = AvgRange ;
X11  = ClOp / point;
X12  = HiOp / point;
X13  = OpLo / point;

string StrH   = tChartPeriod + "(" + myChartPeriodOffset + ") Range " ;
string StrX01 = "Open   " ; 
string StrX02 = "High   " ; 
string StrX03 = "Low    " ; 
string StrX04 = "Close  " ;  
string StrX05 = "Range  " ; 
string StrX06 = "Ret%   " ;
string StrX07 = "Wick%  " ;
string StrX08 = "Body%  " ;  
string StrX09 = "Tail%  " ;  
string StrX10 = "Avg("+myBars+")" ;  
string StrX11 = "Cl-Open" ;  
string StrX12 = "Hi-Open" ;  
string StrX13 = "Open-Lo" ;  
  
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; 



double open1  = iOpen(NULL,myChartPeriod,myChartPeriodOffset+1) ;
double high1  = iHigh(NULL,myChartPeriod,myChartPeriodOffset+1) ; 
double low1   = iLow(NULL,myChartPeriod,myChartPeriodOffset+1) ;    
double close1 = iClose(NULL,myChartPeriod,myChartPeriodOffset+1) ;    
double range1 = high1 - low1 ;





if( open  > open1  ) { color_X01 = Lime ; } else { color_X01 = Red ; } 
if( high  > high1  ) { color_X02 = Lime ; } else { color_X02 = Red ; } 
if( low   > low1   ) { color_X03 = Lime ; } else { color_X03 = Red ; }   
if( close > close1 ) { color_X04 = Lime ; } else { color_X04 = Red ; } 
   
if( xRange > range1 ) { color_X05 = Lime ; } else { color_X05 = Red ; } 
   
if( xRetPct > 100.0 ) { color_X06 = Lime ; } else if( xRetPct < 0 ) { color_X06 = Red ; }
    
if( close > open ) { color_X08 = Lime ; color_X11  = Lime ; } else { color_X08 = Red ;  color_X11 = Red ; }  
     	
if( AvgRange > xRange ) { color_X10 = Lime ; } else { color_X10 = 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 YdistInc, Ydist_X11, Ydist_X12, Ydist_X13 ;
   
    WindowToUse =  0;
    Corner_line = 1;
    Corner_text = 1; Corner_vSRFP = 1;
    Xdist_line = 21; Xdist_text = 93; 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;      

//+------------------------------------------------------------------+ 
   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,0),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,2),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,0),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,0),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,0),myFontSize, myFont, color_X13);
   ObjectSet(dValue13, OBJPROP_CORNER, Corner_vSRFP);
   ObjectSet(dValue13, OBJPROP_XDISTANCE, Xdist_vSRFP);
   ObjectSet(dValue13, OBJPROP_YDISTANCE, Ydist_X13);  
      
*/      
}

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

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 open price.  Green if above previous candle's open price, red if below.

High is candle's high price.  Green if above previous candle's high price, red if below.

Low is candle's low price.  Green if above previous candle's low price, red if below.

Close is candle's close price.  Green if above previous candle's close price, red if below.

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

Ret% is retrace percentage off today's low.

Wick% is the wick (high - 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 - low) percentage of the range.

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

*/