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 Mindset, 04-21-2026, 06:46 AM
            0 responses
            50 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            69 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            36 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by cmoran13, 04-16-2026, 01:02 PM
            0 responses
            97 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            60 views
            0 likes
            Last Post PaulMohn  
            Working...
            X