//+------------------------------------------------------------------+ 
//|   TRO_TopOfHourAlarm                                             | 
//|                                                                  | 
//|   Copyright © 2009, Avery T. Horton, Jr. aka TheRumpledOne       |
//|                                                                  |
//|   PO BOX 43575, TUCSON, AZ 85733                                 |
//|                                                                  |
//|   GIFTS AND DONATIONS ACCEPTED                                   | 
//|   All my indicators should be considered donationware. That is   |
//|   you are free to use them for your personal use, and are        |
//|   under no obligation to pay for them. However, if you do find   |
//|   this or any of my other indicators help you with your trading  |
//|   then any Gift or Donation as a show of appreciation is         |
//|   gratefully accepted.                                           |
//|                                                                  |
//|   Gifts or Donations also keep me motivated in producing more    |
//|   great free indicators. :-)                                     |
//|                                                                  |
//|   PayPal - THERUMPLEDONE@GMAIL.COM                               |  
//+------------------------------------------------------------------+ 

#property  copyright "Copyright © 2009, Avery T. Horton, Jr. aka TRO" 
#property  link      "http://www.therumpledone.com/" 

#property indicator_chart_window
#property indicator_buffers 0

extern int    myMinute   = 55 ;
extern string myAlertMsg = "My Time Alert" ;

datetime tTime ;  
int    elapsed, theMinute, theHour, lastMinute, lastHour ;  
string sTimeLocal ;

bool Alerted = false ;

//+------------------------------------------------------------------+
int init()
  {
   tTime        = 0 ;
   lastMinute   = 99 ;
   lastHour     = 99 ;
   return(0);
  }
//+------------------------------------------------------------------+
int deinit()
  {

   return(0);
  }
//+------------------------------------------------------------------+
int start()
{
 
theMinute = TimeMinute(TimeLocal()) ;
theHour   = TimeHour(TimeLocal()) ;

if( theHour != lastHour ) { lastHour = theHour ; Alerted = false ; }

if( theMinute != lastMinute ) { lastMinute = theMinute ;  }

if(!Alerted && theMinute >= myMinute)
{
   sTimeLocal   = TimeToStr(TimeLocal() );   // local computer time
   Alert( myAlertMsg + " " + sTimeLocal ) ;
   Alerted = true ;
}


   return(0);
  }
//+------------------------------------------------------------------+
/*
string sTimeCurrent = TimeToStr(TimeCurrent(),TIME_SECONDS); // server time
string sTimeLocal   = TimeToStr(TimeLocal(),TIME_SECONDS);   // local computer time
string sTimeBar     = TimeToStr(Time[0],TIME_SECONDS);    // current bar time



  Comment(  
  "Bar....... " + sTimeBar + "\n" +
  "Server.... " + sTimeCurrent + "\n" +
  
//  "Local.... " + TimeLocal() + "\n" +
//  "elapsed= ", elapsed, "\n",      
  "Local..... " + sTimeLocal );    

tTime = TimeLocal() ;     
           

*/