• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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:
            protected override void OnBarUpdate()
            {
                Print ("state: "+State+"   Current Bar: "+CurrentBar+"  "+Time[0].TimeOfDay);
            }

    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.

    Paul H.NinjaTrader Customer Service

    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);

        Paul H.NinjaTrader Customer Service

        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
            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by MavMoney, Today, 07:17 AM
            1 response
            5 views
            0 likes
            Last Post MavMoney  
            Started by jameslee001, Today, 08:09 AM
            0 responses
            5 views
            0 likes
            Last Post jameslee001  
            Started by bertochi, Today, 07:25 AM
            1 response
            2 views
            0 likes
            Last Post bertochi  
            Started by Kentoes, Today, 07:06 AM
            0 responses
            4 views
            0 likes
            Last Post Kentoes
            by Kentoes
             
            Started by third monkey, Today, 06:33 AM
            0 responses
            1 view
            0 likes
            Last Post third monkey  
            Working...
            X