• 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 stoner, Today, 11:47 AM
          0 responses
          2 views
          0 likes
          Last Post stoner
          by stoner
           
          Started by bankavaselina, Today, 10:38 AM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Started by dieterp, Today, 09:40 AM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Heath  
          Started by bankavaselina, Today, 08:51 AM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_PatrickG  
          Started by ballboy11, Today, 09:05 AM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Jim  
          Working...
          X