//+------------------------------------------------------------------+ 
//|                TRO_HOUR                                          | 
//|                                                                  | 
//|   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
 
extern int BarsToCount = 300 ;
 
extern color HourColor = DimGray ;
 
double val1,val2;

int deinit()
  {
   int bars_count=WindowBarsPerChart(), i;
   for (i=0;i<bars_count;i++)
      {
      ObjectDelete("MMt"+DoubleToStr(i,0));
      ObjectDelete("MMl"+DoubleToStr(i,0));
      }
      
      ObjectsDeleteAll( 0, 21);
      ObjectsDeleteAll( 0, 2);



   return(0);
  }
//----------------------------------------------------------------------------------------
int start()
   {
   
   int counted_bars=IndicatorCounted();
   int bars_count=BarsToCount,i,h,m;
   
   bool drawvl;
   
   if (Period() > 30) 
      {
         return(0);    //If time > 1 hour clutters up screen
      }
      
   for (i=0;i<bars_count;i++)
      {
      ObjectDelete("MMt"+DoubleToStr(i,0));
      ObjectDelete("MMl"+DoubleToStr(i,0));
      }
      
   for (i=0;i<bars_count;i++)
      {
         drawvl=false;
         h=TimeHour(Time[i]);
         m=TimeMinute(Time[i]);

         if (m==0) {drawvl=true;VerticalLine("H"+h,i,STYLE_SOLID,HourColor);}

      }
      
   return(0);
   }
   
//----------------------------------------------------------------------------------------------

int VerticalLine(string s,int i,int st,int Col)    //s=Text Label, i = bar, st=Line Style, Col = color
   {
   
   val1=Low[Lowest(NULL,0,MODE_LOW,24,0)];
   val2=High[Highest(NULL,0,MODE_HIGH,24,0)];
      
   ObjectDelete("MMl"+DoubleToStr(i,0));
   
   ObjectCreate("MMl"+DoubleToStr(i,0),OBJ_TREND,0,Time[i],0,Time[i],900);
   ObjectSet("MMl"+DoubleToStr(i,0),OBJPROP_COLOR,Col);
   ObjectSet("MMl"+DoubleToStr(i,0),OBJPROP_WIDTH,1);
   ObjectSet("MMl"+DoubleToStr(i,0),OBJPROP_STYLE,st);
   ObjectSet("MMl"+DoubleToStr(i,0),OBJPROP_RAY,0);
   
   
   ObjectDelete("MMt"+DoubleToStr(i,0));
   
   ObjectCreate("MMt"+DoubleToStr(i,0),OBJ_TEXT,0,Time[i],val2+Point*1);
   ObjectSetText("MMt"+DoubleToStr(i,0),s,8,"Arial",Col);
   ObjectSet("MMt"+DoubleToStr(i,0), OBJPROP_ANGLE, 90);          //Rotates text 90 degrees
   
   ObjectsRedraw();
   
   return(0);
   }


