Definition of iBarShift

 
Hello

How's everybody doing? I'm programming som simple things in MQL4, and i've a question about iBarShift

The documentation defines it like this:

[QUOTE]
Search for bar by open time. The function returns bar shift with the open time specified. If the bar having the specified open time is missing, the function will return -1 or the nearest bar shift depending on the exact.
[/QUOTE]


I'm sorry, i didn't get that. Is it refering to the time the bar opened? E.g the open price of the bar that opened 7.30 for example?
I've got this line:

i4h=iBarShift(NULL,PERIOD_H4,iTime(NULL,0,i),true)+1; but i'm not sure exactly what it does. Anyone care to help
 
The function gives you a barnumber. this barnummer is the bar in the chart that fit to the time which you give as a parameter to the function. if you give a timevalue as parameter to the function on that no bar fits in the chart then the function gives you a barnummber from a bar that fits at nearest to the given time, but you can also set a parameter that the function always gives you a false if no bar fit exactly to your time.
 

If you know a time, iBarShift will give you the index number of the bar for that time for the specified timeframe.

barIndexNumber = iBarShift( symbol, timeframe, time );

Reason: