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 algospoke, Yesterday, 06:40 PM
      2 responses
      19 views
      0 likes
      Last Post algospoke  
      Started by ghoul, Today, 06:02 PM
      3 responses
      14 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by jeronymite, 04-12-2024, 04:26 PM
      3 responses
      45 views
      0 likes
      Last Post jeronymite  
      Started by Barry Milan, Yesterday, 10:35 PM
      7 responses
      20 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by AttiM, 02-14-2024, 05:20 PM
      10 responses
      181 views
      0 likes
      Last Post jeronymite  
      Working...
      X