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 fx.practic, 10-15-2013, 12:53 AM
          5 responses
          5,404 views
          0 likes
          Last Post Bidder
          by Bidder
           
          Started by Shai Samuel, 07-02-2022, 02:46 PM
          4 responses
          95 views
          0 likes
          Last Post Bidder
          by Bidder
           
          Started by DJ888, Yesterday, 10:57 PM
          0 responses
          8 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by MacDad, 02-25-2024, 11:48 PM
          7 responses
          159 views
          0 likes
          Last Post loganjarosz123  
          Started by Belfortbucks, Yesterday, 09:29 PM
          0 responses
          8 views
          0 likes
          Last Post Belfortbucks  
          Working...
          X