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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        80 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        40 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        64 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        66 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        54 views
        0 likes
        Last Post CarlTrading  
        Working...
        X