• 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

Clock on Market Replay

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

    Clock on Market Replay

    Hi My friends,

    Is there any object that holds the date/time value from counter clock for Market Replay?
    I tried DateTime.Now from DataTimeSeries but it gives me actual PC time.

    Thank you


    #2
    Time and times?

    Comment


      #3
      Hello mcosta72,

      Thank you for the note.

      The Times[][] array can be used to access historical DateTime values while backtesting. Please see the following publicly available link on the Times[][] array:

      https://ninjatrader.com/support/help...nt7/?times.htm

      Please let me know if I can assist further.
      Chris L.NinjaTrader Customer Service

      Comment


        #4
        Thank you guys!

        Comment


          #5
          Originally posted by mcosta72 View Post
          Hi My friends,
          I tried DateTime.Now from DataTimeSeries but it gives me actual PC time.
          If you really want a 'DateTime.Now' equivalent to get the datetime from the the market replay connection,
          check out @BarTimer.cs for the free standing 'Now' property.

          Calling 'Now' (not DateTime.Now, just 'Now' by itself) returns the market replay datetime (only if market
          replay is the current connection) otherwise 'Now' defaults to returning value of DateTime.Now.

          Code:
                  private DateTime Now
                  {
                      get
                      {
                          DateTime now = (Bars.MarketData.Connection.Options.Provider == Cbi.Provider.Replay ? Bars.MarketData.Connection.Now : DateTime.Now);
          
                          if (now.Millisecond > 0)
                              now = Cbi.Globals.MinDate.AddSeconds((long) System.Math.Floor(now.Subtract(Cbi.Globals.MinDate).TotalSeconds));
          
                          return now;
                      }
                  }

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by pjsmith, Today, 08:14 AM
          0 responses
          5 views
          0 likes
          Last Post pjsmith
          by pjsmith
           
          Started by levikNT, Today, 07:36 AM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_ChristopherD  
          Started by TazoTodua, Today, 07:27 AM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_JoshG  
          Started by KennyK, Yesterday, 09:47 PM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by Dogmatichacker, Yesterday, 03:52 PM
          1 response
          15 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X