Announcement

Collapse
No announcement yet.

Bar Index Changes

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bar Index Changes

    If I use setComputeOnClose(), the actual bar indexes seem to get offset back by one.

    Normally, I expect the current bar to always be the (0) bar and the previous one to be (-1), etc. That doesn't seem to be the case when using setComputeOnClose() and the bar indexes seem to get offset back by one.

    If I ask for debugPrintln(close(-1)+" "+close(0)) whenever we have a BARSTATE_NEWBAR, the (0) values print for the currently forming bar. If I add setComputeOnClose() in premain, the (0) values print for the prior bar and ignore the currently forming bar.

    I didn't expect this. Is this correct? Thanks.

  • #2
    Re: Bar Index Changes

    Hi Rla1js,

    The behavior you describe is expected. Check this link.

    Steve


    Originally posted by Rla1js
    If I use setComputeOnClose(), the actual bar indexes seem to get offset back by one.

    Normally, I expect the current bar to always be the (0) bar and the previous one to be (-1), etc. That doesn't seem to be the case when using setComputeOnClose() and the bar indexes seem to get offset back by one.

    If I ask for debugPrintln(close(-1)+" "+close(0)) whenever we have a BARSTATE_NEWBAR, the (0) values print for the currently forming bar. If I add setComputeOnClose() in premain, the (0) values print for the prior bar and ignore the currently forming bar.

    I didn't expect this. Is this correct? Thanks.
    link

    Comment


    • #3
      Thanks, Steve. I missed that post with my searches.

      Comment

      Working...
      X