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 NullPointStrategies, Today, 05:17 AM
          0 responses
          20 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          119 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          63 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          41 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          45 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X