iTime problem

 
Hi all.

I've having a problem with iTime returning 0 most of the time. Sometimes it works, but usually it will simply return 0.
The help page says it will return 0 if the local history is empty (not loaded). My History Center for the pair I'm using the strategy tester for says I have history in all time frames.

The code looks like this:
cnt = 0;
while (TimeHour(iTime(ThisPair, PERIOD_H1, cnt)) != midnightET)
{ cnt++;
}

where midnightET is an int with a value of 4 and cnt is also an int. ThisPair is a string that contains the name I'm currently trading (the return value from Symbol())
Any ideas would be great. I'm totally stumped.

Thanks.
Daniel
 
Reason: