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

Indicator with numerous parameters

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

    Indicator with numerous parameters

    If I have written an indicator that has numerous parameters, how do I write an overide function for it that has only say 0 or 1 parameters and sets defaults for all the others, so that when a user wants to include that indicator in their code they don't have to list all the parameters every time.
    Thanks.

    #2
    Hello,

    Thanks for your forum post.

    One of our NinjaScript Certified Tech's will respond in the morning when they get in.

    Thank you for your patience.

    Comment


      #3
      Originally posted by annettes View Post
      If I have written an indicator that has numerous parameters, how do I write an overide function for it that has only say 0 or 1 parameters and sets defaults for all the others, so that when a user wants to include that indicator in their code they don't have to list all the parameters every time.
      Thanks.
      I cant give you a definitive answer, but if you locate the TS SuperTrend indicator, and look at the code .. v2.3 (maybe 2.2 also) has a bool series that can be accessed in a strategy != 1 or -1 for uptrend downtrend ... this might be a start to locate that


      TJ

      Comment


        #4
        Thanks Trader.Jon. I found the indicator you were referring to, but could not find the type of code I am looking for. Thanks for putting me onto that indicator though. It looks great!

        Can anyone else help with this question please. What I really need to know is where to put the code for the override.
        Thanks.

        Comment


          #5
          How about an enum in the Variables section (Say, Model1, Model2, Model3), then assign the values to the variables you want using switch/break? Not sure if you would put in Initialize(), OnStartUp(), or OnBarUpdate(), though. Try it in Initialize() and see how it goes.

          Comment


            #6
            Good idea about the enum, a helpful sample is located here - http://www.ninjatrader.com/support/f...ead.php?t=3420
            BertrandNinjaTrader Customer Service

            Comment


              #7
              I don't think you quite understand what I am asking. I probably didn't explain it very well. I am not asking about the contents of the override function, but where to define it. The main function definition is in the part of the code generated by NinjaScript - i.e. the part we can't change. So if I want to write an alternative definition, with fewer parameters, where do I put it?
              Thanks.

              Comment


                #8
                You would then in this case create a new indicator with fewer user inputs, i.e. more inputs are for example hardcoded by you.
                BertrandNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Shansen, 08-30-2019, 10:18 PM
                24 responses
                938 views
                0 likes
                Last Post spwizard  
                Started by Max238, Today, 01:28 AM
                0 responses
                3 views
                0 likes
                Last Post Max238
                by Max238
                 
                Started by rocketman7, Today, 01:00 AM
                0 responses
                2 views
                0 likes
                Last Post rocketman7  
                Started by wzgy0920, 04-20-2024, 06:09 PM
                2 responses
                27 views
                0 likes
                Last Post wzgy0920  
                Started by wzgy0920, 02-22-2024, 01:11 AM
                5 responses
                32 views
                0 likes
                Last Post wzgy0920  
                Working...
                X