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 vs OnBarUpdate

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

    #16
    Hi rt6176,

    Thanks again for the info, but I'm not sure about your comment here...
    "when no volume indicator bar is formed, NT did not query OnMarketData() or OnMarketDepth()"

    if you are subscribed to level 2 data, when that is updated the OnMarketDepth() handler would update, but not necessarily with volume change, since a trade may or may not have occured.

    What behavior do you expect to see and what discrepancy do you see instead?
    TimNinjaTrader Customer Service

    Comment


      #17
      Originally posted by NinjaTrader_Tim View Post
      Hi rt6176,

      Thanks again for the info, but I'm not sure about your comment here...
      "when no volume indicator bar is formed, NT did not query OnMarketData() or OnMarketDepth()"

      if you are subscribed to level 2 data, when that is updated the OnMarketDepth() handler would update, but not necessarily with volume change, since a trade may or may not have occured.

      What behavior do you expect to see and what discrepancy do you see instead?
      What behavior do I expect??? You guys are so funny!!!

      I expect that when I build an indicator that plots information that is generated in the OnMarketDepth method , that it will plot to the screen for every bar on the price chart.

      Not just some bars, not just most bars, but all bars.

      I have already described my analysis and conclusions in an earlier post..

      But here it is again described differently.

      On the chart in the previous post, for each bar on the price chart there should be a corresponding bar from the

      volume indicator. However, Bars are missing!!!!

      Here is how I located the problem.

      I programmed the print function to create a message every time a method in the indicator is accessed and also programmed a print message every time a new bar is created...

      Between the new bar created messages, there should be both OnBarUpdate and OnMarketDepth messages.

      For the price bars where the volume bars are missing. there are only OnBarUpdate messages. There are no OnMarketDepth messages.

      This means that the OnMarketDepth method did not get accessed.

      No data from OnMarketDepth results in a volume bar with a value of Zero!!!

      OK????

      Thanks for listening,

      RJay



      P.S.

      Can anyone here help me figure out how to manually calling the OnMarketDepth method or the OnMarketData method from inside the OnBarUpdate method? Please contact me!!!

      Thanks Again,

      RJay
      RJay
      NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

      Comment


        #18
        Hi rt6176,

        Thanks for you patience as I continue to gather information so that I can understand what you are doing and offer assistance.

        Between the new bar created messages, there should be both OnBarUpdate and OnMarketDepth messages.
        Agreed.

        For the price bars where the volume bars are missing. there are only OnBarUpdate messages
        So, when you do not see volume (for level one data, price change), you do not see the OnMarketDepth being updated? Does this occur for every instance there is no price change?
        TimNinjaTrader Customer Service

        Comment


          #19
          Hi Tim,

          It doesn't matter what kind of price bar is being formed. The problem occurs with up bars, down bars, and bars that close at open.

          RJay
          RJay
          NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

          Comment


            #20
            Hi rt6176,

            And when that occurs, you do not see the OnMarketDepth being updated? Does this occur for every instance there is no price change?

            As a side note, it is possible that level 2 (OnMarketDepth) does not change while price does change.
            TimNinjaTrader Customer Service

            Comment


              #21
              Originally posted by NinjaTrader_Tim View Post
              Hi rt6176,

              And when that occurs, you do not see the OnMarketDepth being updated? Does this occur for every instance there is no price change?

              As a side note, it is possible that level 2 (OnMarketDepth) does not change while price does change.

              Tim,

              What I've been trying to tell you is that a price change does not eliminate the problem.

              The problem can happen whether there is price change or no price change.

              And sometimes when the problem occurs, the price bar may move as many as 3 ticks either up or down.

              That in itself causes a change in the book. Yet there is no timely OnMarketDepth update to refresh the data.

              RJay
              RJay
              NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

              Comment


                #22
                Hi rt6176,

                I see, if the the price is moving that many ticks, the OnMaretDepth should be called, as the depth would be shifting price levels.

                Are you using 6.5 or 7?
                Can you supply an example of when the case you mentioned occurs (several ticks in price change leading to no Level II change)
                TimNinjaTrader Customer Service

                Comment


                  #23
                  Hi Tim,

                  I've been doing a lot of research and I've found what may be a problem.

                  In onMarketData, I am able to access order data with the three following MarketDataType sources.


                  (e.MarketDataType == MarketDataType.Ask )

                  (e.MarketDataType == MarketDataType.Bid )

                  (e.MarketDataType == MarketDataType.Last )



                  However, when I attempt to duplicate this test within OnMarketDepth,

                  Only Ask and Bid return order data.

                  I get no data at all when using MarketDataType.Last .

                  I need to be able to access Last from OnMarketDepth.

                  This may be causing my missing bars problem.

                  Can you help?

                  Thanks,

                  RJay
                  RJay
                  NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

                  Comment


                    #24
                    Hi rt6176,

                    Unfortunately, OnMarketDepth will only display level II data, not last data.

                    If you want to access both, you will need to use OnMarketDepth along with OnBarUpdate, or with OnMarketData.
                    TimNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by trilliantrader, 04-18-2024, 08:16 AM
                    4 responses
                    18 views
                    0 likes
                    Last Post trilliantrader  
                    Started by mgco4you, Today, 09:46 PM
                    1 response
                    10 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by wzgy0920, Today, 09:53 PM
                    0 responses
                    10 views
                    0 likes
                    Last Post wzgy0920  
                    Started by Rapine Heihei, Today, 08:19 PM
                    1 response
                    10 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by Rapine Heihei, Today, 08:25 PM
                    0 responses
                    10 views
                    0 likes
                    Last Post Rapine Heihei  
                    Working...
                    X