Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnMarketData and OnBarUpdate

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

    OnMarketData and OnBarUpdate

    Hello everybody

    I know for sure that after a OnMarketData event always will come a OnBarUpdate event. My question is: Can I be sure that after an execution of OnMarketData there will be no other OnMarketData before the execution of the OnBarUpdate corresponding to the first OnMarketData execution?

    I need to be sure of this because I use in OnBarUpdate variables which are updated in OnMarketData, so I don´t want that the second execution overrides the values in the variables before OnBarUpdate executes.

    Thanks in advance

    #2
    Hello telbentel,

    With NinjaTrader being multi-threaded, you should not rely on any particular sequence of events like OnMarketData() always being called before OnBarUpdate() or vice versa.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by telbentel View Post
      Hello everybody

      I know for sure that after a OnMarketData event always will come a OnBarUpdate event. My question is: Can I be sure that after an execution of OnMarketData there will be no other OnMarketData before the execution of the OnBarUpdate corresponding to the first OnMarketData execution?

      I need to be sure of this because I use in OnBarUpdate variables which are updated in OnMarketData, so I don´t want that the second execution overrides the values in the variables before OnBarUpdate executes.

      Thanks in advance
      There are many more OnMarketData events than OnBarUpdate events.
      RJay
      NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

      Comment


        #4
        Hello again.

        I'm not to sure about the answer you gave me Ryan_M. I read in the documentation that a call to OBU occurs everytime there is a new tick (when CalculateOnBarClose==false), and also a new OMD event of type last will occur everytime a new tick arrives, so, for each new tick there will be 1 OMD of type last and 1 OBU. I'm right?

        If the above is true, the question will be only if you can assume any order between the OMD event of type last and the OBU produced for the occurece of the same tick. I made this question in a previous post (http://www.ninjatrader.com/support/forum/showthread.php?t=34050) and one of your partners answer to me that there is an order, OMD comes first. This seems logical because OMD will receive all the changes and if the event is of type last then a new tick has arrived and all bars, time, etc are updated and a call to OBU is produced.

        So, the only thing remaing is if you can have the situation where an OMD occurs (and the asociated call to OnMarketData), and before the corresponding OBU occurs for the first OMD, can another OMD occurs?

        I know there are more OMD events than OBU, but I'm refering just to OMD events of type last.

        Thanks.

        Comment


          #5
          telbentel, if (and that is a very big if) you are only looking at OnMarketData() of type Last, then there should be a 1 to 1 ratio of OMD to OBU. I will have someone confirm this on Monday.
          AustinNinjaTrader Customer Service

          Comment


            #6
            telbentel,

            To clarify, there is no guaranteed order between OnBarUpdate() and OnMarketData(). There will be a one for one relationship, just no guaranteed ordering.
            Josh P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            566 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            330 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            547 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            548 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X