Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Last trade on OnBarUpdate()

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

    Last trade on OnBarUpdate()

    What is the equivalent of OnMarketData()'s MarketDataType.Price (of MarketDataType.Last data type) in the OnBarUpdate()? Is it Close[0] with CalculateOnBarClose = false?

    In other words, I'm looking for the last trade price while in the OnBarUpdate() method.

    #2
    Yesterday, NinjaTrader_RyanM said:

    You can work with CurrentBar in relation to Count to identify the last bar on the chart.

    When CalculateOnBarClose = true:
    if (Count - 2 == CurrentBar)

    When CalculateOnbarClose = false:
    if (Count - 1 == CurrentBar)

    --EV

    Comment


      #3
      Originally posted by emini.ninja View Post
      What is the equivalent of OnMarketData()'s MarketDataType.Price (of MarketDataType.Last data type) in the OnBarUpdate()? Is it Close[0] with CalculateOnBarClose = false?

      In other words, I'm looking for the last trade price while in the OnBarUpdate() method.
      Correct, you would work with Close[0] and COBC = false, giving you the last tick value (since NT is multithreaded you can run into race conditions comparing it to OnMarketData's Last value though).

      Comment


        #4
        Awesome. Thanks for the quick response!

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Hwop38, 05-04-2026, 07:02 PM
        0 responses
        176 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        331 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        254 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        356 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        184 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X