Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How do I access methods in an indicator for
Collapse
X
-
Bertrand, I thought I followed the example you provided by Adding the indicator like this:-
First error: The name TDSetup doesnot exist in the current context.Code:[FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff] protected[/COLOR][/COLOR][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]override[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] Initialize() { Add(TDSetup); Add(draftMA1); CalculateOnBarClose = [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]; } [/SIZE][/FONT][/SIZE][/FONT]
Second error: The best overloaded method match for 'NinjaTrader.Strategy.StrategyBase.Add(NinjaTrader .Indicator.IndicatorBase)' has some invalid arguments.
Third error: cannot convert from 'method group' to 'NinjaTrader.Indicator.IndicatorBase'
Please advise what is wrong. Thx!
[/SIZE][/FONT][/SIZE][/FONT]
Comment
-
It is actually a series of 9 consecutive counts where each count's close is lower than the respective close 4 bars ago. it is a non-conventional indicator i suppose, which is why i asked how do you access methods from within an indicator for use in a strategy...
Comment
-
Comment
-
Bertrand, I cut and pasted the indicator code to the strategy...2 errors
The name 'Overlay' doesnot exist in the current context.
The name 'PriceTypeSupported' does not exist in the current context.
Would removing these 2 lines from Initialize() affect the strategy? That would mean I will get no display on the chart, right? But everything is being worked in the background, right?
Comment
-
Kay, correct both those properties do not exist for NinjaScript strategies, so you would need to remove those to be able to compile it.
Not being familiar with your custom code, if you Draw it should be drawing in the strategy as well, but there would be no plots from the strategy excpect with workarounds...
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
572 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
331 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
549 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
550 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment