Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 bortz, 11-06-2023, 08:04 AM
            47 responses
            1,602 views
            0 likes
            Last Post aligator  
            Started by jaybedreamin, Today, 05:56 PM
            0 responses
            8 views
            0 likes
            Last Post jaybedreamin  
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            18 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            4 views
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            12 views
            0 likes
            Last Post Javierw.ok  
            Working...
            X