Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnBarUpdate is not getting the most current data

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

    OnBarUpdate is not getting the most current data

    Hello support,

    I am using Ninjatrader 8.0.27.1 64-bit

    I am developing a strategy with Strategy Analyzer. I printed out the Time[0] and Close[0] of all the bars just for testing purposes, and I notice that it does not print the latest price. For example, the latest price I have in my Ninjtrader is from August 2nd, but the my prints stop at August 1st. Is this a bug or is it done on purpose?


    #2
    Hello op1031,

    That is normal, the backtest by default does not include the current day, it should end 1 day before the current date. You can include the current day if you change the date to the current day or greater and are also connected to a data provider so the current days historical data can be downloaded. If you are not seeing that happen in that version you may need to update to a more recent version of the platform, this is how it works in the current 8.1.3.1 version.

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello op1031,

      You can include the current day if you change the date to the current day or greater and are also connected to a data provider so the current days historical data can be downloaded. If you are not seeing that happen in that version you may need to update to a more recent version of the platform, this is how it works in the current 8.1.3.1 version.
      I am setting the date to the current day and greater already, but it's still not showing the latest day. So I will update my Ninjatrader version to 8.1.3.1 then.
      Thank you

      Comment


        #4
        Originally posted by NinjaTrader_Jesse View Post
        Hello op1031,

        That is normal, the backtest by default does not include the current day, it should end 1 day before the current date. You can include the current day if you change the date to the current day or greater and are also connected to a data provider so the current days historical data can be downloaded. If you are not seeing that happen in that version you may need to update to a more recent version of the platform, this is how it works in the current 8.1.3.1 version.
        I just installed version 8.1.3.1 and it is still behaving the same way. I basically have a variable, currentPrice = Close[0], in my Day Series, and I print out currentPrice when the State == State.Terminated, meaning the backtest is complete.

        I set the end date to August 20th which is a few days after today's date (August 15th), and the currentPrice is yesterday's price (August 14th)
        If I go to the chart, I can see the price for August 15th, but I am unable to get that price during backtest for some reason. Any ideas on what I can do to get the latest price?
        Last edited by op1031; 08-16-2024, 01:03 AM.

        Comment


          #5
          Hello op1031,

          That may be due to your logic, if you just view the backtest chart do you see the current days data? I just tried this on my end and looking at the chart while using daily bars I see a bar for the 16th.

          Click image for larger version

Name:	NinjaTrader_NhNTtxX7p9.png
Views:	86
Size:	72.0 KB
ID:	1314462

          Comment


            #6
            Originally posted by NinjaTrader_Jesse View Post
            Hello op1031,

            That may be due to your logic, if you just view the backtest chart do you see the current days data?
            Yes, I can see the data for the current day from the chart, but when I can't seem to access the data for the current day from Strategy Analyzer.
            Like I said, if I simply print out Close[0] every day, I don't see the data for the current day. I only see the data up to yesterday.

            Comment


              #7
              Hello op1031,

              Then that would be correct, the final daily bar on the chart won't have a bar close event because there is not a bar following it. By selecting the current day that would only allow you to use the available data which is up to the 15th because that is the last closed bar on the daily series. With a more granular series you could have bar closes during the current days session.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Today, 05:17 AM
              0 responses
              44 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              126 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              65 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              42 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              46 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X