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!
See more
See less

Partner 728x90

Collapse

Creating a Reusable Class

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

  • Yandychang
    replied
    Never mind then, it was a file I had excluded to be able to compile... I think it was NT 8

    Leave a comment:


  • NinjaTrader_Jesse
    replied
    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.

    Leave a comment:


  • Yandychang
    replied
    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...

    Leave a comment:


  • NinjaTrader_Jesse
    replied
    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.

    Leave a comment:


  • Yandychang
    replied
    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

    Leave a comment:


  • NinjaTrader_Jesse
    replied
    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.

    Leave a comment:


  • Yandychang
    replied
    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

    Leave a comment:


  • NinjaTrader_PatrickH
    replied
    Hello Yandychang,

    Thank you for your post.

    Can you provide an example of the code that generates an error?

    Leave a comment:


  • Yandychang
    started a topic Creating a Reusable Class

    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?

Latest Posts

Collapse

Topics Statistics Last Post
Started by Haiasi, Today, 06:53 PM
1 response
3 views
0 likes
Last Post NinjaTrader_Manfred  
Started by ScottWalsh, Today, 06:52 PM
1 response
6 views
0 likes
Last Post NinjaTrader_Manfred  
Started by ScottW, Today, 06:09 PM
1 response
4 views
0 likes
Last Post NinjaTrader_Manfred  
Started by ftsc2022, 10-25-2022, 12:03 PM
5 responses
256 views
0 likes
Last Post KeyonMatthews  
Started by Board game geek, 10-29-2023, 12:00 PM
14 responses
244 views
0 likes
Last Post DJ888
by DJ888
 
Working...
X