. How can I tell NT not try to create an instance of this indicator class and still be able to use it and create future indicators?
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Creating a Reusable Class
Collapse
X
-
Creating a Reusable Class
I created an abstract CustomIndicatorBase class, in order to reuse my Code... I did it in NT 7 for my startegies and it worked well. But when I try to create them for NT 8 as an Indicator, the ninjatrader Generated Code returns a problem. When it tries to create a new Instance of the Indicator( since Abstract Classes cannot be instantiated) I get a cannot create an instance error:
. How can I tell NT not try to create an instance of this indicator class and still be able to use it and create future indicators? -
Abstract Class
Sure, Attached is a test code that reproduces the error, could not make it into a Zip because NT 8 says I have to fix the error before exporting...Attached Files
Comment
-
Hello,
Thank you for providing the sample,
I tried this concept in NT7 but do also see the same error that the abstract class can not be created. Additionally I see that you said in NT7 you used this for Strategies and now are using it for Indicators, this would likely be expected as there is no Wrapper code appended to a strategy.
Could you compose a very simple example of the structure used in NT7 so we can confirm that this is identical to what you had done that was already working?
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
-
Regarding Abstract Class
Actually, On NT 7, it did not throw any errors, it compiled Fine... NT skipped adding the Ninjascript Generated Code... my NT7 version is 7.0.1000.30.Attached Files
Comment
-
Hello,
Thank you for the sample.
I do see that when you remove the generated code it allows it to compile in nt7. I am unsure in regard to design if this was expected or not, but in either case I have submitted this sample to development for further review to see if this can be moved to match nt7.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
-
I have not tried this yet, but I noticed that the file name generated by nt7 starts with @@... Maybe renaming the file and adding @@ in front of the name in NT8 makes a quick fix...
Comment
-
Hello,
Where are you seeing a file name generated by nt7 that starts with @@?
@@ in NT8 would be to exclude a NinjaScript item, this is what occurs when you right click and exclude from compilation in the new editor.
For NinjaTrader 7 I would be unsure where you are seeing @@.
I look forward to being of further assistance.JesseNinjaTrader Customer Service
Comment
-
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Waxavi, Today, 02:10 AM
|
0 responses
4 views
0 likes
|
Last Post
by Waxavi
Today, 02:10 AM
|
||
Started by TradeForge, Today, 02:09 AM
|
0 responses
10 views
0 likes
|
Last Post
by TradeForge
Today, 02:09 AM
|
||
Started by Waxavi, Today, 02:00 AM
|
0 responses
2 views
0 likes
|
Last Post
by Waxavi
Today, 02:00 AM
|
||
Started by elirion, Today, 01:36 AM
|
0 responses
4 views
0 likes
|
Last Post
by elirion
Today, 01:36 AM
|
||
Is it possible to have a drawing, such as a line, cycle through different colors?
by gentlebenthebear
Started by gentlebenthebear, Today, 01:30 AM
|
0 responses
4 views
0 likes
|
Last Post Today, 01:30 AM |
Comment