• 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 danitralla, Yesterday, 03:33 AM
          1 response
          20 views
          0 likes
          Last Post NinjaTrader_ShawnB  
          Started by ninjo, Yesterday, 11:54 AM
          0 responses
          6 views
          0 likes
          Last Post ninjo
          by ninjo
           
          Started by deblanka, Yesterday, 08:56 AM
          0 responses
          13 views
          0 likes
          Last Post deblanka  
          Started by Boonfly8, 03-22-2019, 12:30 PM
          7 responses
          26 views
          0 likes
          Last Post sledge
          by sledge
           
          Started by Sohal, Yesterday, 05:02 AM
          2 responses
          23 views
          0 likes
          Last Post techmint  
          Working...
          X