Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

bar time vs. trade time?

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

    bar time vs. trade time?

    Is it true that the "Time" of a bar is always its Closing time, even as the bar is being formed when CalculateOnBarClose = false in realtime during an OnBarUpdate call?

    If so, then is the OnMarketData callback the only way to get the time of a trade? (Other than looking at one's system clock during OnBarUpdate when CalculateOnBarClose = false.)

    Thanks.

    #2
    Correct on the timestamps. If you want to get time of a trade you can also check out the IExecution or even IOrder objects. They have a time property. http://www.ninjatrader-support.com/H...Execution.html
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      thanks Josh!

      A related question: Since bars are stamped with their closing time, then is it true that watching for a bar "Time" change (in realtime) is equivalent to watching for FirstTickOfBar = true? (i.e., one stores the current bar Time in a Strategy variable, and then watches for a new Time to show up)

      Comment


        #4
        Yes, but I don't know why you would want to use timestamps to do that when you could use if (FirstTickOfBar).
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by Josh View Post
          Yes, but I don't know why you would want to use timestamps to do that when you could use if (FirstTickOfBar).
          It turns out there is some common code I can write for both historical and realtime processing of bars if I compare bar times to determine if a new bar has been started. A small thing, but I just wanted to doublecheck that I wasn't missing something about FirstTickOfBar. Thanks.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by CarlTrading, 03-31-2026, 09:41 PM
          1 response
          68 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          39 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          63 views
          1 like
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          62 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          53 views
          0 likes
          Last Post CarlTrading  
          Working...
          X