Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 pechtri, 06-22-2023, 02:31 AM
          10 responses
          124 views
          0 likes
          Last Post Leeroy_Jenkins  
          Started by judysamnt7, 03-13-2023, 09:11 AM
          4 responses
          59 views
          0 likes
          Last Post DynamicTest  
          Started by ScottWalsh, Yesterday, 06:52 PM
          4 responses
          36 views
          0 likes
          Last Post ScottWalsh  
          Started by olisav57, Yesterday, 07:39 PM
          0 responses
          7 views
          0 likes
          Last Post olisav57  
          Started by trilliantrader, Yesterday, 03:01 PM
          2 responses
          22 views
          0 likes
          Last Post helpwanted  
          Working...
          X