Inaccurate Hourly Bar High/Low when running EA on Daily chart

 
Hello, I am running an EA on the daily chart and I need to find out whether or not the current price is above or below the last H1 high or low (depending on whether the entry will be long or short) in order to make the decision whether or not to enter.  However using iHigh(NULL,PERIOD_H1,1) or iLow(NULL,PERIOD_H1,1) does not give the last H1 high/low but gives a high/low several bars back (maybe as many as 20 bars, different each time it runs). The number of bars back it goes is not consistent. I did not use iHigh(NULL,PERIOD_H1,0) because I need the high of the last H1 bar, not the current one. What should I do please?
 
Well check the open time of the H1-bars: iTime(NULL,PERIOD_H1,1) and try High[1] and Low[1] and Time[1] on the H1-Chart.
 

If you haven't looked at the different timeframe in the last ten minutes it will be out of sync.

Either grab something (like iHigh) each tick to keep it updated, or check for the errors 4066 and 4073 and retry

 
WHRoeder:

If you haven't looked at the different timeframe in the last ten minutes it will be out of sync.

Either grab something (like iHigh) each tick to keep it updated, or check for the errors 4066 and 4073 and retry

thanks I'll give it a try