Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator constructor overload

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

    Indicator constructor overload

    Many of my indicators have parameters that are formatting based, such as opacity, etc. Is there away to overload the constructor of an indicator so that I don't have to provide those parameters and they can just use their default values?

    Alternatively, add another attribute to the parameter that makes it optional? or use the optional parameter C# syntax.
    Last edited by GrumpyTrader; 09-29-2015, 02:24 PM.

    #2
    Hi GrumpyTrader,

    I am not aware of a way in C# to call a method or function without the defined overloads.

    However, you could make a copy of the indicator that hard codes these instead of making them public inputs.

    This thread is also open to anyone who may know of a way to accomplish this and would like to contribute.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by GrumpyTrader View Post
      Many of my indicators have parameters that are formatting based, such as opacity, etc. Is there away to overload the constructor of an indicator so that I don't have to provide those parameters and they can just use their default values?

      Alternatively, add another attribute to the parameter that makes it optional? or use the optional parameter C# syntax.
      Hi GrumpyTrader,

      Try removing the "[NinjaScriptProperty]" tag from in front of the properties you don't want to pass to the indicator.

      Comment


        #4
        Thanks NJA_MC,
        That worked perfectly !! You're a lifesaver.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by kinfxhk, 07-13-2026, 10:18 AM
        0 responses
        24 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 09:50 AM
        0 responses
        14 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 07:21 AM
        0 responses
        20 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-11-2026, 02:11 AM
        0 responses
        20 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        135 views
        0 likes
        Last Post SalmaTrader  
        Working...
        X