How to detect end of the day/ market close time?

 
What is the easiest way to know if it's almost the end of the day or the market has been closed?
 
If the market is closed there will be no ticks, and of course, the start() function of any EA is called with each tick, so one thing you can do is when a new tick is received, determine the time since the last tick, and if that is more than some given length of time (let's say 1 hour), then you at least know the market just opened. I sometimes find this useful in dealing with Monday morning volatility. As for knowing when the market is about to close, this should for the most part be available from your broker (i.e. they might always close at 23:00 on Friday).
Reason: