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 Mindset, 04-21-2026, 06:46 AM
          0 responses
          117 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by M4ndoo, 04-20-2026, 05:21 PM
          0 responses
          166 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by M4ndoo, 04-19-2026, 05:54 PM
          0 responses
          85 views
          0 likes
          Last Post M4ndoo
          by M4ndoo
           
          Started by cmoran13, 04-16-2026, 01:02 PM
          0 responses
          130 views
          0 likes
          Last Post cmoran13  
          Started by PaulMohn, 04-10-2026, 11:11 AM
          0 responses
          88 views
          0 likes
          Last Post PaulMohn  
          Working...
          X