Bill M: No candle on this start opens at 08:41. Because of this, I thought iBarShift would return -1 as I had set the exact parameter to true.
M2 8:40 bar includes [8:40:00 – 8:41:59]
[in] A return value, in case the bar with the specified time is not found.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi. I was hoping someone could help me to understand iBarShift as it should do exactly what I'm looking for based on the documentation, but it's actual results are not what I'm expecting.
In particular, I had understood by setting the parameter exact to true that the given time must line up to the open of a candle, rather than just somewhere within it. Have I misunderstood iBarShift?
Here is a very simple example to demonstrate.
Running this, I get the following result.
Now, the first two results (iBarShift returning 9 for the M1 chart and 4 for the M2 chart) are what I'd expect; as 08:40 is the open time for a candle on both of these charts (at the time, the shifts were 9 and 4 respectively).
However, it's the final result that I don't understand. I've asked for the shift for the candle at 08:41 on the M2 chart. No candle on this start opens at 08:41. Because of this, I thought iBarShift would return -1 as I had set the exact parameter to true.
Can someone please explain why I'm not getting -1, or how I've misunderstood iBarShift?
Thanks very much!