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 habeebft, Today, 07:27 AM
          1 response
          13 views
          0 likes
          Last Post NinjaTrader_ChristopherS  
          Started by AveryFlynn, Today, 04:57 AM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by Max238, Today, 01:28 AM
          4 responses
          37 views
          0 likes
          Last Post Max238
          by Max238
           
          Started by r68cervera, Today, 05:29 AM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by geddyisodin, Today, 05:20 AM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X