• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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 dukeoferl, Today, 03:26 AM
0 responses
1 view
0 likes
Last Post dukeoferl  
Started by Titelluvifa, Today, 02:49 AM
0 responses
2 views
0 likes
Last Post Titelluvifa  
Started by rehagen, Today, 01:44 AM
0 responses
2 views
0 likes
Last Post rehagen
by rehagen
 
Started by bouncetherubble, Yesterday, 07:33 PM
0 responses
7 views
0 likes
Last Post bouncetherubble  
Started by gmachine, Yesterday, 07:15 PM
0 responses
7 views
0 likes
Last Post gmachine  
Working...
X