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 Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        591 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        343 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        556 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        553 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X