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 fx.practic, 10-15-2013, 12:53 AM
          5 responses
          5,404 views
          0 likes
          Last Post Bidder
          by Bidder
           
          Started by Shai Samuel, 07-02-2022, 02:46 PM
          4 responses
          95 views
          0 likes
          Last Post Bidder
          by Bidder
           
          Started by DJ888, Yesterday, 10:57 PM
          0 responses
          7 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by MacDad, 02-25-2024, 11:48 PM
          7 responses
          159 views
          0 likes
          Last Post loganjarosz123  
          Started by Belfortbucks, Yesterday, 09:29 PM
          0 responses
          8 views
          0 likes
          Last Post Belfortbucks  
          Working...
          X