Announcement

Collapse
No announcement yet.

BARSTATE_NEWBAR and low()

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

  • BARSTATE_NEWBAR and low()

    When BARSTATE_NEWBAR tests true, is low() equal to the low of the bar just completed or the current bar which is just starting?

    Seems like the low of the bar that just completed.

    Just checking my guess, thanks for the feedback.

  • #2
    I believe you are correct...

    D,

    I believe this is the case (and also why I use the getValue("rawtime",0) function).

    The way I use it, the "bar Time" has to change, thus a new bar has started to form. Also, that previous bar is finished forming.

    Thus, low() = the low of the current bar

    and

    low(-1) = the low of the previous bar.

    Hope this helps..

    Brad
    Brad Matheny
    eSignal Solution Provider since 2000

    Comment


    • #3
      When BARSTATE_NEWBAR tests true, is low() equal to the low of the bar just completed or the current bar which is just starting?
      You will get the low for the current bar. Note that what this looks like will be very different between historical and RT data. With historical data, because the bar has been completed already, checking for low() after newbar will get you the low as of the close of the bar. But in RT mode you are getting the low as of the first tick of the bar...which should be the same value as if you asked for close() or high() since there is only one value at this point for the bar, and that is the value of the first tick.

      Hope this helps...

      Garth
      Garth

      Comment


      • #4
        I wrote a little efs to show what happens when getBarSTate()== BARSTATE_NEWBAR, sending the low close and high for bars 0 and -1 to the FOW.

        Wen GBS==true, the 0 bar has the same l c and h, while the -1 bar has the prvious bars values.

        see attached picture
        Attached Files

        Comment


        • #5
          David,

          I assume you were running this in RT on some low interval chart?

          If you run it on historical data only, (like IBM, D) you will see that the OHLC infor for bar 0 is different.

          I have done fairly extensive testing on this, and know it works as I stated below.

          Garth
          Garth

          Comment

          Working...
          X