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 CaptainJack, 05-29-2026, 05:09 AM
        0 responses
        237 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 05-29-2026, 12:02 AM
        0 responses
        152 views
        0 likes
        Last Post CaptainJack  
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        163 views
        1 like
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        246 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        199 views
        0 likes
        Last Post CarlTrading  
        Working...
        X