Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time[0].TimeofDay is always the session end time while in Market Replay

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

    Time[0].TimeofDay is always the session end time while in Market Replay

    Time[0].TimeofDay is always the session end time while in Market Replay.
    I run an indicator with Calculate = OnPriceChange in Market Replay.
    My indicator uses the Time[0].TimeOfDay but it's wrong. It's always the session close time. I guess time stamps are not stored in the playback data?

    #2
    Hello Brillo,

    Thanks for your post.

    The data is time stamped and it would be expected to show the end of the bar time stamp in market replay (if using time based bars) or the tick time if using non time based bars.

    I've tested this with both Market replay data and historical data and the bar or tick time is always shown (Tested with 1 minute bars and Renko bars size 5) using:

    Code:
    [I]        protected override void OnBarUpdate()
            {
                Print ("state: "+State+"   Current Bar: "+CurrentBar+"  "+Time[0].TimeOfDay);
            }[/I]

    Please test with the above print statement and advise if you still see the same. If so then please provide further information about the data/bars you are testing on/with.

    Comment


      #3
      After the indicator transitions to realtime I get output like this:
      state: Realtime Current Bar: 299 17:00:00
      I'm running on 1440 minute bars on ES default template. The Playback window displays the current time as 1/6/2020 4:33:22 AM. I expect the Time[0] to return the same.

      Comment


        #4
        Hello Brillo,

        Thanks for your reply.

        As you are using a 1440 minute bar, it would be expected that the bar close time (Time[0]) will be the session close time, this would be true for playback or real time.

        To get the market replay time, try this: Print ("state: "+State+" Current Bar: "+CurrentBar+" "+Cbi.Connection.PlaybackConnection.Now);

        Comment


          #5
          I see. So for testing I can use PlaybackConnection.Now and for a live realtime just use DateTime.Now.
          Is there a way to determine if the connection is playback or on a real account?

          Comment


            #6
            Hello Brillo,

            Thanks for your reply.

            Yes, here is a test for the Playback connection:

            if (Cbi.Connection.PlaybackConnection != null)
            Print ("Connected to Playback");
            else
            Print ("not connected to playback");


            Another approach would be to check the account name as Playback always connects with Playback101: https://ninjatrader.com/support/help...gy_account.htm

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            566 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            330 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            547 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            548 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X