Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time Stamp not correct on Bars

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

    Time Stamp not correct on Bars

    Hi guys, I am testing my strategy real-time and when I print time[o] it shows me a time that is 1 hour before the current time, even though the close[0] data is correct. I am running the strategy on 60 minute bars (also 1 hour before on other bars like 120 minute). Any idea why this is doing this? I am using a print statement in the output window to show me the time.

    #2
    Hello elitetradernyc,

    What do you have "Calculate on bar close" set to?
    JCNinjaTrader Customer Service

    Comment


      #3
      In initialize: CalculateOnBarClose = true;

      Comment


        #4
        Hello elitetradernyc,

        If you set CalculateOnBarClose to false do you see the output time that you are expecting after you reloaded your NinjaScript?

        Note that you can override the CalculateOnBarClose setting in the Indicators parameters section.
        JCNinjaTrader Customer Service

        Comment


          #5
          Hi Sir, yes it does calculate right, now it seems to be continuously calculating the close for the 60 minute bar as 1:30PM eastern time. What next?

          Comment


            #6
            Hello elitetradernyc,

            Great, the reason why you are seeing the values being 1 hour late is because NinjaTrader is going to be calculating only once at the close of each bar. So to be able to get real-time updates you would have to keep CalculateOnBarClose (COBC) set to false but NinjaTrade will calculate your NinjaScript on each incoming tick of data. Using COBC set to true you will have to wait till the bar closes to be able to see the hour pass.

            Note that you can use the FirstTickOfBar as a condition if you would like to keep COBC set to false and only have it print once per bar.
            JCNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            113 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            60 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            40 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            43 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            81 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X