When passing an IBar with OfferSide ASK as the first parameter and an IBar with OfferSide BID as the second parameter to an indicator, depending on the timeframe sometimes the passed BID bar (the 2nd input argument) is shifted forward by 1 period.
I've attached an indicator source for showing the min/max/close spread of the bars in the chart.
When this indicator is run on EUR/CHF on the ONE_MINUTE timeframe, the BID bar will be shifted by 1 period into the future.
I've included a workaround in the code and a logging that shows the shifting..
Example: With the attached indicator run on EUR/CHF on the 1 minute timeframe, the following messages are written to the console:
Quote:
...
21:43:56 ERROR - BID shifted forward: 3.6p ASK=1311970740000[2011-07-29 20:19:00.000+0000] O: 1.1314 C: 1.13167 H: 1.13167 L: 1.1314 V: 44.0 BID=1311970800000[2011-07-29 20:20:00.000+0000] O: 1.13145 C: 1.13147 H: 1.13149 L: 1.13145 V: 13.0
21:43:56 ERROR - BID shifted forward: 2.9p ASK=1311970680000[2011-07-29 20:18:00.000+0000] O: 1.13176 C: 1.13141 H: 1.13183 L: 1.13141 V: 83.0 BID=1311970740000[2011-07-29 20:19:00.000+0000] O: 1.13107 C: 1.13147 H: 1.13147 L: 1.13107 V: 53.0
21:43:56 ERROR - BID shifted forward: 2.7p ASK=1311970620000[2011-07-29 20:17:00.000+0000] O: 1.13177 C: 1.13171 H: 1.13177 L: 1.13164 V: 37.0 BID=1311970680000[2011-07-29 20:18:00.000+0000] O: 1.13145 C: 1.13105 H: 1.13158 L: 1.13105 V: 81.0
21:43:56 ERROR - BID shifted forward: 3.0p ASK=1311970560000[2011-07-29 20:16:00.000+0000] O: 1.13188 C: 1.13174 H: 1.13188 L: 1.13174 V: 45.0 BID=1311970620000[2011-07-29 20:17:00.000+0000] O: 1.13147 C: 1.13142 H: 1.13147 L: 1.13137 V: 33.0
21:43:56 ERROR - BID shifted forward: 4.3p ASK=1311970500000[2011-07-29 20:15:00.000+0000] O: 1.13177 C: 1.13188 H: 1.13197 L: 1.13176 V: 39.0 BID=1311970560000[2011-07-29 20:16:00.000+0000] O: 1.13157 C: 1.13147 H: 1.13157 L: 1.13142 V: 37.0
21:43:56 ERROR - BID shifted forward: 5.6p ASK=1311970440000[2011-07-29 20:14:00.000+0000] O: 1.13218 C: 1.13175 H: 1.13225 L: 1.13173 V: 68.0 BID=1311970500000[2011-07-29 20:15:00.000+0000] O: 1.13134 C: 1.13158 H: 1.13158 L: 1.13131 V: 32.0
21:43:56 ERROR - BID shifted forward: 4.2p ASK=1311970380000[2011-07-29 20:13:00.000+0000] O: 1.13245 C: 1.1322 H: 1.13245 L: 1.13216 V: 34.0 BID=1311970440000[2011-07-29 20:14:00.000+0000] O: 1.1316 C: 1.13132 H: 1.13167 L: 1.13131 V: 63.0
21:43:56 ERROR - BID shifted forward: 5.1p ASK=1311970320000[2011-07-29 20:12:00.000+0000] O: 1.13199 C: 1.13245 H: 1.1325 L: 1.13199 V: 59.0 BID=1311970380000[2011-07-29 20:13:00.000+0000] O: 1.13204 C: 1.13164 H: 1.13204 L: 1.1316 V: 28.0
21:43:56 ERROR - BID shifted forward: 2.2p ASK=1311970260000[2011-07-29 20:11:00.000+0000] O: 1.13193 C: 1.13199 H: 1.13199 L: 1.13184 V: 36.0 BID=1311970320000[2011-07-29 20:12:00.000+0000] O: 1.13149 C: 1.13203 H: 1.13203 L: 1.13149 V: 60.0
...
Best regards,
RR.