Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Value[0] inside OnBarClose()

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

    Value[0] inside OnBarClose()

    Just need a clarification here, if I am inside the OnBarClose function and I reference Value[0], is that the bar that just closed? or is the going to be the value of the current bar that is building now?

    ie to get the value of the bar that just closed while in OnBarClose, which index do I reference, Value[0] or Value[1]?

    and if it is Value[0]... how do I get the value of the bar that is currently being built?

    Thanks,

    Jon

    #2
    Hello Jon,
    Close[0] represents Closing price of bar that is closed & new bar started to form while using OnBarClose,
    Close[0] represents Closing price of bar that is forming i.e. the newest bar on chart while using OnEachTick or OnPriceChange.
    Hope it helps!

    Comment


      #3
      Hello JMellen,

      Thanks for your post.

      In addition to forum member s.kinra's advise, please see the help guide reference here: https://ninjatrader.com/support/help...ice_series.htm

      Value[] and Values[][] typically are associated with Plots that are added to the script. You can use the various price series directly of Open, High, Low, and Close.

      The bars ago index [] is as forum member s.kinra advised related to the calculate setting of the script AND if the data being processed is historical or real-time.
      Reference: https://ninjatrader.com/support/help...?calculate.htm

      Comment


        #4
        Thanks s.kinra and Paul, this is very helpful!

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        62 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        134 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        75 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        50 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X