Alternatively, add another attribute to the parameter that makes it optional? or use the optional parameter C# syntax.
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Indicator constructor overload
Collapse
X
-
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.Tags: None
-
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
-
Originally posted by GrumpyTrader View PostMany 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.
Try removing the "[NinjaScriptProperty]" tag from in front of the properties you don't want to pass to the indicator.
Comment
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by ETFVoyageur, Today, 04:00 PM
|
1 response
7 views
0 likes
|
Last Post
by ETFVoyageur
Today, 06:53 PM
|
||
Started by AaronKTradingForum, Today, 03:44 PM
|
1 response
8 views
0 likes
|
Last Post Today, 03:51 PM | ||
Started by Felix Reichert, 04-26-2024, 02:12 PM
|
11 responses
77 views
0 likes
|
Last Post Today, 03:18 PM | ||
Started by junkone, 04-28-2024, 02:19 PM
|
7 responses
83 views
1 like
|
Last Post
by junkone
Today, 03:15 PM
|
||
Started by pechtri, 06-22-2023, 02:31 AM
|
11 responses
139 views
0 likes
|
Last Post
by Nyman
Today, 02:59 PM
|
Comment