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 trilliantrader, 04-18-2024, 08:16 AM
          5 responses
          22 views
          0 likes
          Last Post trilliantrader  
          Started by Davidtowleii, Today, 12:15 AM
          0 responses
          3 views
          0 likes
          Last Post Davidtowleii  
          Started by guillembm, Yesterday, 11:25 AM
          2 responses
          9 views
          0 likes
          Last Post guillembm  
          Started by junkone, 04-21-2024, 07:17 AM
          9 responses
          68 views
          0 likes
          Last Post jeronymite  
          Started by mgco4you, Yesterday, 09:46 PM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Working...
          X