Announcement

Collapse
No announcement yet.

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
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      633 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      567 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X