Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Getting millisecond accurate DateTime of current Tick

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

    Getting millisecond accurate DateTime of current Tick

    I'm trying to get a DateTime for the current Tick inside OnBarUpdate() with millisecond accuracy that I see in the Historical Data view.

    I'm using NT8, MNQ 15 second bars. I've set calculate to OnEachTick and am printing string Time[0] and Time[0].Ticks for each call to OnBarUpdate. I'm seeing the same value for all calls during the same bar.

    OnBarUpdate()
    2021-12-10 14:55:30:000 | 637747449300000000
    2021-12-10 14:55:30:000 | 637747449300000000
    2021-12-10 14:55:30:000 | 637747449300000000
    2021-12-10 14:55:30:000 | 637747449300000000
    2021-12-10 14:55:45:000 | 637747449450000000
    2021-12-10 14:55:45:000 | 637747449450000000
    2021-12-10 14:55:45:000 | 637747449450000000
    2021-12-10 14:55:45:000 | 637747449450000000


    #2
    Hello athyssen,

    Thanks for your post.

    Time-based bars, such as 15-second bars, will have timestamps based on the closing time of that bar.

    Tick-based bars, such as 15-tick bars, will have a finer timestamp granularity than time-based bars.

    Something you could do is consider checking for marketDataUpdate.Time timestamps within the OnMarketData() method. See the attached reference sample demonstrating this.

    See the help guide page below for more information about OnMarketData.
    OnMarketData(): https://ninjatrader.com/support/help...marketdata.htm

    Let us know if we may assist further.
    Attached Files
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Thank you. I am now keep the latest time passed into OnMarketData and using that when I log other events.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by andrewtrades, Today, 04:57 PM
      1 response
      8 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by chbruno, Today, 04:10 PM
      0 responses
      6 views
      0 likes
      Last Post chbruno
      by chbruno
       
      Started by josh18955, 03-25-2023, 11:16 AM
      6 responses
      436 views
      0 likes
      Last Post Delerium  
      Started by FAQtrader, Today, 03:35 PM
      0 responses
      7 views
      0 likes
      Last Post FAQtrader  
      Started by rocketman7, Today, 09:41 AM
      5 responses
      19 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X