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

Error : "There is no definition of 'Rows' in 'NinjaTrader.Gui.SuperDom.SuperDom'."

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

    Error : "There is no definition of 'Rows' in 'NinjaTrader.Gui.SuperDom.SuperDom'."

    HI. I am writing my own custom indicator that makes use of the logic in the Volume Column of the superdom. I want my indicator to basically get all the respective values of buy volume , sell volume and total volume for each price row of the superdom and then populate a List object with the data (so that I can later on do some operations with the data). However, when I tried to compile the indicator, I got the error that I mentioned in the title. How can it be resolved. Please advise. Thanks in advance.
    Attached Files

    #2
    Hello mbesha,

    This has two possible causes. Either you try to reference something called Rows in your code, or your class fails to implement a prescribed member called Rows. If the word Rows appears in your code, it is likely the first, if it does not, it is likely the second. You can press ctrl + f to examine your code to search for the word rows.

    If the second case, you will want to review the documentation for SuperDOM columns. I am providing a top-level link for convenience.



    If you can provide a stripped down code sample we can provide more direct assistance. Please don't hesitate to reach out if there are any other ways we can help.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Hi JessicaP. There are 2 references to 'Rows' in my code (on lines 183 and 184) in the OnRender method. Here is the exact snippet :

      protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
      {
      lock (SuperDom.Rows)
      foreach (PriceRow row in SuperDom.Rows)
      {
      ......


      As one of my import statements I had the following (using NinjaTrader.Gui.SuperDom;) so I am not sure why Rows isn't being implemented. Does it matter that my script is for an indicator (with the namespace Indicators) rather than a SuperDomColumn (with the namespace SuperDomColumns)? As I already mentioned, I got the code off the Volume script for SuperDomColumns. Please advise.

      Comment


        #4
        Hello mbesha,

        We will definitely need to remove or refactor those lines of code, as SuperDom does not contain a member named Rows. I have included a video which demonstrates using IntelliSense to determine which valid members SuperDom has, which should also save some time developing in the future. I would recommend reviewing this video and letting us know if any other questions come up that we may answer.

        Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.
        Jessica P.NinjaTrader Customer Service

        Comment


          #5
          Hi JessicaP. Thanks for your feedback and for the video.

          I guess then that my question would be in what class can I find the 'Rows' as they clearly are a member of some class. I found 'Rows' in the very code provided by NT8 in the Ninjascript editor (SuperDomColumns folder -> Volume). I have attached the original script that comes with NT8 for your reference (please look at lines 151 and 152). When I hover over the term with my mouse, I got a message saying "Observable Collection<PriceRow> SuperDomViewModel.Rows". This "Rows" member is what I would like to use in my script for my indicator. Could you please show me how? Thanks.
          Attached Files

          Comment


            #6
            This confused me at first as well, until I found this line of code in that file that you mentioned.

            Code:
            [FONT=Courier New]if (State == State.Active &&[B] SuperDom != null[/B] && SuperDom.IsConnected)[/FONT]
            The part I emphasized let me know that SuperDom is both the name of a class, and a name of a member of the SuperDomColumn class. Rows is part of SuperDomColumn.SuperDom , not NinjaTrader.Gui.SuperDom.SuperDom .

            In order to access SuperDomColumn.SuperDom, we must have a SuperDomColumn instance. The easiest way to generate one of these is to right-click the Volume class you mentioned in the NinjaScript editor, select "save as", and give it a different name. This will create a copy of the Volume indicator you can safely modify and access SuperDomViewModel.Rows from .

            The other way to access a SuperDomColumn element such as SuperDomColumn.SuperDom.Rows would be to create a new SuperDomColumn instance. If Rows is a protected element, you will instead want to make a class of your own that extends SuperDomColumn and access Rows that way. We know that Rows is not private to SuperDomColumn, since the Volume class was able to access it, so one of these strategies will definitely work.

            I am attaching some pictures I grabbed from IntelliSense from within a copy of the Volume indicator.
            Attached Files
            Last edited by NinjaTrader_JessicaP; 09-29-2016, 10:39 AM.
            Jessica P.NinjaTrader Customer Service

            Comment


              #7
              Thanks a lot JessicaP for the prompt and insightful feedback. I was actually thinking of doing the first option you recommended but I was worried that since I wanted an indicator that would work with my charts rather than with the superdom, I thought it would not be a good idea to take that route. As for the second option, it sounds like it has a lot of potential. So should I do something like this:

              //Create instance as a global variable
              private SuperDomColumn mySuperDom = new SuperDomColumn();

              //then use it to call the Rows member
              lock (SuperDom.Rows)
              foreach (PriceRow row in SuperDom.Rows)
              {
              ......

              Please let me know. My programming knowledge is a bit limited. Thanks for all the help.

              Comment


                #8
                You definitely have the right idea. This is going to take a little bit of trial and error. If the approach you are trying to take does not work due to access protection, you would instead have to do something like

                Code:
                [FONT=Courier New]private class MySuperDomColumn : NinjaTrader.Gui.SuperDom.SuperDomColumn
                {
                    public System.Collections.ObjectModel.ObservableCollection<PriceRow> getRows()
                    {
                        return SuperDom.Rows;
                    }
                }
                
                protected override void OnBarUpdate()
                {
                    System.Collections.ObjectModel.ObservableCollection<PriceRow> Rows = new MySuperDomColumn().getRows();
                    // ...[/FONT]
                To put that together, I started with one of the two images I sent you, the Rows.png file. That let me know that Rows is of type ObservableCollection. I already knew from the C# file you sent me that we were inside of a SuperDomColumn. The investigation I needed to do, then, involved finding a fully qualified path for these two symbols, SuperDomColumn and ObservableCollection.

                I was able to derive NinjaTrader.Gui.SuperDom.SuperDomColumn using IntelliSense and the C# file you sent me.

                I was able to derive System.Collections.ObjectModel.ObservableCollectio n by searching the help guide documentation for ObservableCollection, which led me to this page,



                And finally this publicly available MSDN documentation,

                Represents a dynamic data collection that provides notifications when items get added or removed, or when the whole list is refreshed.


                You can of course save yourself a lot of typing with a using declaration, I just wanted to send you a code sample that would definitely compile if copied and pasted.
                Jessica P.NinjaTrader Customer Service

                Comment


                  #9
                  Hi JessicaP

                  Thanks as always for your helpful feedback and support. After much time and effort at trying option 2 to work, I've given up on it because I think it requires more programming skill than I currently possess .Working with classes belonging to different namespaces (Indicator and SuperDomColumn) while creating my own custom classes has proved to be quite challenging. I think I'll go with option one. I'll just create a copy of the Volume code of the SuperDomColumns and tweak it as you proposed. I'll just incorporate my own code into the original such that the buy and sell volume values for each price row of the superdom are saved in my own custom List<T>.

                  The question I am left with is is it possible to have the code I write, which is for the SuperDom, plot on a chart? I would like to use the data I collect in my List to plot certain drawing objects on my chart but is this possible (considering the code is for the SuperDom)? If it is not possible, how can I "export" my List for lack of a better word to an indicator which I can then use on a chart? Please advise. Looking forward to hearing from you.

                  Comment


                    #10
                    The easiest way to do this would be to make your code which plots on a chart part of a native strategy or indicator, and to make that in addition to your add on. Making two products in this way would be much simpler, and better supported by the documentation. Since you will likely want to pass information between these two NinjaScripts, and have had some experience with classes with this project, there is a way I believe you will find easier than the recommended approach. I am including a publicly available link from the MSDN C# documentation which will guide you toward putting together a global scope file in NT8.

                    The C# namespace alias qualifier `::` is used to access a member of an aliased namespace. The `::` operator is often used with the `global` alias, an alias for the global namespace


                    With that file, you can simply write information you would like to pass to your indicator or strategy to a variable, and your indicator or variable can then read from that same variable.
                    Jessica P.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by rajendrasubedi2023, Today, 09:50 AM
                    0 responses
                    2 views
                    0 likes
                    Last Post rajendrasubedi2023  
                    Started by ender_wiggum, Today, 09:50 AM
                    0 responses
                    1 view
                    0 likes
                    Last Post ender_wiggum  
                    Started by bmartz, Today, 09:30 AM
                    1 response
                    7 views
                    0 likes
                    Last Post NinjaTrader_Erick  
                    Started by geddyisodin, Today, 05:20 AM
                    3 responses
                    20 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Started by lorem, Today, 09:18 AM
                    1 response
                    5 views
                    0 likes
                    Last Post lorem
                    by lorem
                     
                    Working...
                    X