When I loop through bars (eg for (bar =1; bar < barCount ;bar++)
BarIndex[bar] does not match the bar displayed under the crossbar (it is always shifted by 1), so when the BarIndex[bar] = x, bar under the crossbar = x+1).
Any idea why ? and what to do in afl , so they much.
Thank you
Bar index is zero based whereas barcount is number of bars in the array
Just google amibroker barcount versus barindex gives this link
Read down—- Common Coding mistakes
Well, for programmers the only way to access bars is by using BarIndex() function which is zero based. Now imagine that you are not a programmer, but a software tester or a user who try to verify signals produced by a program . They go and view charts to verify signals. Obviously, under the cross bar, bar numbers, which are not zero based, do not much bar numbers generated by programs.
They have all the rights to claim that programs don't work !!