iBarShift returns -1 . . but it shouldn't !

Simon Gniadkowski
17411

OK, before you all jump in . . . I know iBarShift CAN return -1 if I set exact to true and there is not an exact match . . but I didn't . . . here is my code.

OpenBar = iBarShift(NULL, PERIOD_M1, OrderOpenTime()); 

if (D3) Print("OpenBar = ", OpenBar, " OpenTime: ",TimeToStr(OrderOpenTime(),TIME_DATE|TIME_MINUTES) );

. . . and the output from the log . . .

14:21:05 OBTraderV2T EURUSD,H1: OpenBar = -1 OpenTime: 2011.08.05 15:23

The only thing I could think happened is that I was missing the M1 15:23 bar and the current M1 bar was the 15:22 bar . . .

William Roeder
25856
William Roeder  

The first time you reference another chart (pair & TF) that's not already open, you get an error: ERR_HISTORY_WILL_UPDATED 4066 Requested history data in updating state.

next time capture getLastError and then print.

Simon Gniadkowski
17411
It's on the same chart, but thanks for this: ERR_HISTORY_WILL_UPDATED 4066 Requested history data in updating state, I'll check for that. :-)
William Roeder
25856
William Roeder  
RaptorUK:
It's on the same chart,

OpenBar = iBarShift(NULL, PERIOD_M1, OrderOpenTime()); 
14:21:05 OBTraderV2T EURUSD,H1: OpenBar = -1
Not the same chart M1 != H1
Simon Gniadkowski
17411
WHRoeder:

Not the same chart M1 != H1

OK, I'm with you :-)