Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Optional parameters

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

    Optional parameters

    How can I define the public variable of an indicator so that it is 'optional' when the indicator is instantiated from within another indicator? For instance I have defined an indicator where one of the public variable is the thickness of the plot...I don't want to have to specify the thickness of the plot each time I instantiate that indicator to access its other properties.

    #2
    trader2be, I would just create 2 methods then, one offering to adjust it, the other setting it hardcoded.

    Comment


      #3
      Bertrand,
      How would I implement those two methods inside the indicator code?
      Thanks,
      David

      Comment


        #4
        David, what I mean was you create basically two indicators that would give you also 2 overloads then to call programmatically for your other scripts - for the 'system' one just use only the public properties you would like to adjust via code, the other hardcode in so the overload gets 'cleaned' up.

        Comment


          #5
          Would you have an example of something like this by any chance?

          Comment


            #6
            Unfortunately not - you would simply make a copy of your indicator and then remove some of the unneeded public properties / user inputs and instead set a hard-coded value as internal variable only (which is done anyways in the code), if you them compile changes in another indicator overload is created which you could use to simplify calling the needed value from yet another script.

            Comment


              #7
              Any required naming conventions for this additional indicator? I assume that it must have a different name.

              Comment


                #8
                Yes, correct - you would save it then under a different name and modify, perhaps with a ...'simple' suffix to show the simplified inputs...

                Comment


                  #9
                  Thanks, I will try this. Also when calling my indicator through code, the Intellisense kicks in and provides a few potential combinations of parameters. Usually one will include "Input" then the list of custom parameters, and another will just include the list of custom parameters (Input then becomes optional). Would the overload you propose show up in this Intellisense?

                  Comment


                    #10
                    Yes, the method would show up for any indicator you created, so the new one is available as well when you compiled the code in.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    650 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
                    577 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X