iBarShift() ambiguity

 
iBarShift() ... the function will return -1 or the nearest bar shift depending on the exact...

The "nearest" keeps always an ambiguity, so I suggest that the function returns the first bar which time is less than or equal to the specified time.
Please, look at this very common example :
I have an opened order and I want to know the low of the bar on which the order was opened.
The OrderOpenTime is not generally the open time of a bar, so
iBarShift(NULL, 0, OrderOpenTime(), false) will return the right shift if the order was opened in the first half period of the bar, but the wrong shift if the order was opened in the second half period.
It's just a consistency question, I know that I can write:
int shift = iBarShift(NULL, 0, OrderOpenTime(), false);
if(Time[shift] > OrderOpenTime()) shift ++;
 


Thanks for your comment,
Michel

Reason: