Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnBarClose() and indexing of data points

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

    OnBarClose() and indexing of data points

    Hi All,


    Question. When OnBarClose() is called, are we still 'in' the bar that just closed or have we moved onto the next (new) bar for the purposes of indexing of data points.

    For example, it's just struck 16:00. And the OnBarClose() method of 5 min bars has been called because the 15:55 bar has just ended. IF I now look at Open[0] will I be looking at the open of the 15:55 bar or the open of the new and in progress 16:00 bar...?

    Many Thanks

    #2
    OnBarUpdate() is called in a backtest on the close of the bar. In real-time it will depend on the property CalculateOnBarClose. If true, then on the close of a bar. If false, then on each incoming tick for that bar.
    RayNinjaTrader Customer Service

    Comment


      #3
      Thanks Ray. Yup, I got that.

      Just for clarity... From the point of view of historical data (i.e. backtesting) OHLCV data is not produced for any bar until it closes... is that correct...??

      i.e. in my example, in backtest it's 16:00... if I look at Open[0] it will give me the open of the 15:55 bar...??

      Comment


        #4
        In backtest, Close[0] will give you the close price for the bar with the time stamp provided by Time[0].

        So if Time[0] is 16:00, you will get the close of the bar for that time stamp.
        RayNinjaTrader Customer Service

        Comment


          #5
          Thanks Ray. That's what I need.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          580 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          335 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          102 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          554 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          552 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X