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
-
Hi GrumpyTrader,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 CaptainJack, 05-29-2026, 05:09 AM
|
0 responses
48 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 05:09 AM
|
||
|
Started by CaptainJack, 05-29-2026, 12:02 AM
|
0 responses
30 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 12:02 AM
|
||
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
99 views
0 likes
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
177 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
170 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|

Comment