How to find out number of bars for timeframe which is not currently displayed on chart?

 
Greetings, I want to iterate through all bars of the timeframe which may not be current on the chart e.g. the current time frame is daily, and I'd like to iterate though hourly e.g. iTime(NULL, PERIOD_H1, i). How can I get the number of bars on the hourly chart? Using while(true) with break when some condition met is subject to infinite looping (which constantly happens while I am debugging causing MT crash). Thank you in advance.
 
 
Thanks a lot, Irtron