Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Where is bid/ask size?

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

    #16
    Profitmake, your outcomes are expected as you work in the OnBarUpdate() that would trigger updates on each tick if CalculateOnBarClose is set to false.

    For updates on each Level 1 data change, you would need to work in the OnMarketData() method as suggested.

    Historical bid / ask data series access is supported for IB in our NinjaTrader 7 release, which is currently in public beta.
    BertrandNinjaTrader Customer Service

    Comment


      #17
      I'm up against a brick wall again. I tried to modified it from "OnBarUpdate()" into "OnMarketData()". It didn't work. Here's the modified code:
      Code:
              protected override void OnMarketData(MarketDataEventArgs e)
              {
                  if (Historical)
                      return;
                  
                  BidSize0.Set(GetCurrentBidVolume());
              }
      I tried some other variations too to no avail.

      Sorry Bertrand, may I ask you to help me once more?

      I merely need some coding advice this time and for this particular issue only. I deadly want the ability to watch bid/ask/last size in Market Analyzer.

      Historical bid / ask data series access is supported for IB in our NinjaTrader 7 release, which is currently in public beta.
      How can I access those data? Removing this bit of code doesn't seem to work:
      Code:
                if (Historical)
                      return;

      Comment


        #18
        For historical bid / ask data series access, please add the respective MarketDataType in the Initialize of the indicator in NT7 -

        Code:
        Add("ES 06-10", PeriodType.Minute, 1, MarketDataType.Ask);
        Then you can access the data via pointing to this BarsArray[1] or using Closes[1][0]



        For a correct way to work in OnMarketData(), please see the snippet we have in the helpguide for this method -

        BertrandNinjaTrader Customer Service

        Comment


          #19
          Code:
          Add("ES 06-10", PeriodType.Minute, 1, MarketDataType.Ask);
          But this code is hardcoded to load the ask size of ES 06-10. I want to load whatever instrument it's currently in. This has to be a variable.

          For a correct way to work in OnMarketData(), please see the snippet we have in the helpguide for this method -

          http://www.ninjatrader.com/support/h...marketdata.htm
          I have read this more than ten times in a few days. However I have nearly zero programming knowledge so many don't make sense to me at all. I simply kept "brute-forcing" to see if the code works "magically".

          I even tried the example and it still failed:
          protected override void OnMarketData(MarketDataEventArgs e)
          {
          // Print some data to the Output window
          if (e.MarketDataType == MarketDataType.Last)
          Print("Last = " + e.Price + " " + e.Volume);
          else if (e.MarketDataType == MarketDataType.Ask)
          Print("Ask = " + e.Price + " " + e.Volume);
          else if (e.MarketDataType == MarketDataType.Bid)
          Print("Bid = " + e.Price + " " + e.Volume);
          }
          Error message:
          "NinjaTrader.Indicator.BidSize' does not implement inherited abstract member 'NinjaTrader.Indicator.IndicatorBase.OnBarUpdate() '"

          I don't understand what this message means. It appears I'm forced to use OnBarUpdate(). Other codes just don't pass the compile test.

          I tried over 1 hour in vain. If it's just a few lines of codes to achieve this, I hope anyone could kindly give me a better pointer so I can watch up-to-date bid/ask/last size in Market Analyzer. Thank you in advance.

          I'm still trying in the meantime.

          Comment


            #20
            Profitmake, you could make the instrument input for this a string user input so you could enter a symbol to be used.

            Were you trying to use the OnMarketData() snippet outside the OnBarUpdate() method? This would be needed, as it will not work inside the OnBarUpdate() as it's an own method in NinjaScript.

            Since you're not a programmer, it might be best to pass this work to a consultant to create the needed code for you -

            BertrandNinjaTrader Customer Service

            Comment


              #21
              Well my purpose hasn't been changed from day 1. I just want to display bid size, ask size, last size. Unfortunately those information aren't readily available in the columns . That's why I'm trying very hard now.

              I simply try to hack based on the file you gave it to me last time. Originally I should be all happy. Unfortunately your sample used OnBarUpdate() method, not OnMarketData() method.

              I pointed out the problems and you suggested OnMarketData() method. Unfotunately I'm up against a brick wall now since I'm unable to hack your sample to use OnMarketData() method instead.

              My first attempt


              I have replaced OnBarUpdate() with OnMarketData() so I don't understand what the error message says.




              I tried quite many different variations to see if I can guess the right line of the code. I have spent about 30 minutes on that in vain.


              Second attempt

              I simply copied the example to see how it works. But I couldn't pass the compile test.




              I'm searching for simple samples which use OnMarketData() method so I can grab one and try to mock it. So far I couldn't find one.

              I tried other variations too. All failed. I must have made some very dummy mistakes. I don't think it's worth wasting space to post screenshots here.
              Attached Files

              Comment


                #22
                Regarding consultant, it would be silly to ask a consultant for such a simple task that may only take a minute to code. The consultant may laugh out load at me for such a dumb task. I'd better ask people or members on the forum to help this time.

                I hope you could help me on this issue if it only takes a few lines of codes to complete it. Otherwise let's just forget it as it's not a reasonable request. I'm still evaluating this software and see whether it fits my trading needs. I will definitely need a consultant to code my system later if I decide this is the right software which I should work on it.

                PS: I clicked on the button for info of CS0534 butthe help program failed to redirect me to the right page.
                Last edited by Profitmake; 05-14-2010, 01:03 PM.

                Comment


                  #23
                  Profitmake,

                  BidSize is likely a reserved word. You will need to name your indicator differently.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #24
                    Hello Josh, I created another indicator called ShowBidVol. The same error message occurred when I used OnMarketData() in the code. I still keep trying in the meantime.

                    Comment


                      #25
                      ProfitMake,

                      You will get error messages from all indicators when you compile, not just the one you're working with.

                      The bulk of the code you have is the same from this page http://www.ninjatrader-support.com/H...arketData.html

                      This code compiles successfully.

                      You're trying to Set a DataSeries within OnMarketData and this won't work. Data Series are synced to bar objects so you will have to do this within OnBarUpdate()

                      In the future when sharing code you're using, can you copy and paste the text rather than images?
                      Ryan M.NinjaTrader Customer Service

                      Comment


                        #26
                        Originally posted by NinjaTrader_RyanM View Post
                        The bulk of the code you have is the same from this page http://www.ninjatrader-support.com/H...arketData.html

                        This code compiles successfully.
                        Yes I used the sample code just to make sure that pat of code must be error free. Then I tried to fit this bit of code into the file given on this thread but it didn't work.

                        I know it's a bad way to spot the problem area. Anyway this part is not important.

                        Originally posted by NinjaTrader_RyanM View Post
                        You're trying to Set a DataSeries within OnMarketData and this won't work. Data Series are synced to bar objects so you will have to do this within OnBarUpdate()
                        I have tried it for two days before I asked again.
                        Could you tell me what code exactly I should use to replace DataSeries?
                        Or perhaps you have a sample OnMarketData() with /
                        bis/ask so I can try to imitate it?

                        Originally posted by NinjaTrader_RyanM View Post
                        In the future when sharing code you're using, can you copy and paste the text rather than images?
                        Yes if you prefer it. But the code would be very long since it will always expand every potion of codes.

                        Comment


                          #27
                          Profitmake, please attach the latest version of you're cs file directly so we can take a look at what you attempt doing. You can find the file in the Documents\NinjaTrader 6.5\bin\Custom\Indicator folder. If you just work very close alongside the sample from the helpguide you should be able to compile and see the prints for last, bid, ask from the OnMarketData() method accessing the Level 1 stream directly.
                          BertrandNinjaTrader Customer Service

                          Comment


                            #28
                            Here you are.

                            Nothing interesting have been done on the indicators. No change I made could pass the compile test so I simply revert to the last state. You may simply create a new sample to replace the mess.

                            The indicators are simply based on the sample you gave me last time. My purpose is to plot bid/ask size and update properly in real-time.
                            Attached Files

                            Comment


                              #29
                              Hello Profitmake,

                              Was using a prior version of your code and it plotted successfully.

                              The current one has the same issue where values are set within OnMarketData().

                              You may need to pursuse this with a 3rd party NinjaScript consultant who can develop your code to your exact specifications.
                              Attached Files
                              Last edited by NinjaTrader_RyanM1; 05-18-2010, 09:16 AM.
                              Ryan M.NinjaTrader Customer Service

                              Comment


                                #30
                                I was looking to do the same and wrote two simple bid size and ask size indicators for the purpose of calling them up within the Market Analyzer. I posted them to the Ninja Version 7 Indicator section of the forum. It is called "Bid and Ask Sizes".

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by bortz, 11-06-2023, 08:04 AM
                                47 responses
                                1,610 views
                                0 likes
                                Last Post aligator  
                                Started by jaybedreamin, Today, 05:56 PM
                                0 responses
                                9 views
                                0 likes
                                Last Post jaybedreamin  
                                Started by DJ888, 04-16-2024, 06:09 PM
                                6 responses
                                19 views
                                0 likes
                                Last Post DJ888
                                by DJ888
                                 
                                Started by Jon17, Today, 04:33 PM
                                0 responses
                                6 views
                                0 likes
                                Last Post Jon17
                                by Jon17
                                 
                                Started by Javierw.ok, Today, 04:12 PM
                                0 responses
                                16 views
                                0 likes
                                Last Post Javierw.ok  
                                Working...
                                X