Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Constructors

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

    Constructors

    Hi,

    This is more curiosity than anything. I wrote an indicator for use with my strategy. I wrote it as an indicator because I will also use it natively on a chart.

    When I was writing the code to add it to my strategy Intellisense showed 4 constructors. Contructor 3 is the constructor as I intended it, constructor 4 is just the same but showing the IDataSeries input; this is what I expected.

    I also have two more constructors (one a duplicate of the other but with an IDataSeries as an input). The extra constructor (set) looks like it has optional parameters as it matches a prior version of the indicator before I added some additional parameters.

    This got me to thinking; I have been under the assumption that the call to an indicator from a strategy had to match the signature of the public properties in the indicator. Is this correct and if so why do I have the extra set of constructors?

    Thanks,
    Scott

    #2
    Scott,

    It does need to match your indicators public properties. Likely just remnants from your prior version. Try compiling the NinjaScript assembly and perhaps restart NT and see if it gets propagated all the way through then.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Josh, that was it. After I restarted, all was as expected. Thanks.

      By the way, is it possible to order the parameters in terms of the constructor like you could do in straight class definitions in C#?

      As it is, it appears they show up alphabetically (looking at IntelliSense). If I have an indicator with several inputs, that leaves me with a lot of room for fat finger errors.
      Last edited by ScottB; 03-22-2011, 05:19 PM.

      Comment


        #4
        Great, thanks for reporting back Scott - for the ordering you can try different categories applying a numbered prefix to your public properties, this should help straightening the visual layout.

        Comment


          #5
          Thanks Bertrand, I will play around with that. I already separate the standard "Parameters" into several categories and use the \t trick to order the inputs within the property page.

          Having coded C# for years prior to starting with NinjaTrader gives me a little insight into how to do certain things but with others I need a nudge in the right direction sometimes.

          Best Regards,
          Scott

          Comment


            #6
            trick

            Can you give an example of the \t trick you mention?
            Haven't heard of that one.

            Comment


              #7
              Mindset,

              Please see here for a description of it: http://www.ninjatrader.com/support/f...ead.php?t=4770
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Mindset, it seems Josh already pointed you in the right direction (thanks Josh). I must say it works perfectly and makes sorting out your parameters much easier.

                Comment


                  #9
                  thanks

                  To both.
                  I have been setting my own parameters and numbering them - which I think is better if you have a large amount of sorting to do - but this snippet is great if you only have say 3 or 4.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  649 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  370 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  109 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  574 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  576 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X