Right now, I have EOD but am moving to real-time later. I have setPriceStudy(true) and setComputeOnClose(), and realized that for studies using an interval of less than daily, getCurrentBarIndex() never gets to zero. It stops at -1. It does result in zero for daily, weekly and monthly charts. The popup on the price chart, however, does show the first bar to have an index of zero regardless of interval, and high(...) does return a value for the "zero" bar.
With BARSTATE_NEWBAR, I have to check for interval first and then the bar index equal 0 or -1 before executing some code after the chart is initially loaded and after subsequent new bars. Is this correct? Something doesn't seem right.
Thanks.
With BARSTATE_NEWBAR, I have to check for interval first and then the bar index equal 0 or -1 before executing some code after the chart is initially loaded and after subsequent new bars. Is this correct? Something doesn't seem right.
Thanks.
Comment