Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Derived Indicator classes not built properly

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

    Derived Indicator classes not built properly

    I've written an indicator that inherits from Indicator. I want to use that to accomplish some things with some minor additions so I inherited another indicator from that. In that class, the compiler fails to generate a constructor that I can use in a strategy.

    This is a departure from NT7 because what I'm really doing is converting indicators that did generate a constructor for my strategy in NT7.

    How to reproduce.

    1. Create a class, derived from type Indicator.and change the inheritance from Indicator to any class of type Indicator.

    2. You can call the base classes if you want but either way, Ninjascript will not generate the code needed to use the derived class in a strategy.

    The derived indicator does work when you load it onto a chart, but without a constructor, there is no way to call it from a strategy. I know - I could copy the code from the original indicator and simply inherit from indicator, but that leaves the old "duplicate code" issue which is not good programming practice. Besides, what I'm doing is supposed to work. In fact, everyone should inherit instead of copying code.

    Thanks again guys.
    Attached Files

    #2
    Originally posted by traderpards View Post
    I've written an indicator that inherits from Indicator. I want to use that to accomplish some things with some minor additions so I inherited another indicator from that. In that class, the compiler fails to generate a constructor that I can use in a strategy.

    This is a departure from NT7 because what I'm really doing is converting indicators that did generate a constructor for my strategy in NT7.

    How to reproduce.

    1. Create a class, derived from type Indicator.and change the inheritance from Indicator to any class of type Indicator.

    2. You can call the base classes if you want but either way, Ninjascript will not generate the code needed to use the derived class in a strategy.

    The derived indicator does work when you load it onto a chart, but without a constructor, there is no way to call it from a strategy. I know - I could copy the code from the original indicator and simply inherit from indicator, but that leaves the old "duplicate code" issue which is not good programming practice. Besides, what I'm doing is supposed to work. In fact, everyone should inherit instead of copying code.

    Thanks again guys.
    Duplicate of this?

    ref: http://ninjatrader.com/support/forum...ad.php?t=78777

    Comment


      #3
      Put your reader into threaded mode, then start reading from here.



      That way you can follow the thread from where the basic issue was isolated it would seem. It seems that it has been isolated to the same issue, albeit the initial manifestation was certainly very different.

      Comment


        #4
        I don't think so. I went back to the first post in that thread and couldn't even tell what the problem was. Reading the thread leads you to believe it's about sub-folders and <whatever> - even the Support team had trouble understanding what the poster was talking about. I guess there was an issue running an indicator through a strategy and also on a chart at the same time. That isn't this.

        Here, I should be able to inherit from an indicator and enjoy the fruits of the virtual chain and also be able to instantiate that class in a strategy. Period. That's it, and I can't. I don't need several long posts to attempt to explain it. It really is that simple.

        Comment


          #5
          Hello traderpards,

          Thank you for your inquiry.

          I will be investigating this and will return with my findings.
          Zachary G.NinjaTrader Customer Service

          Comment


            #6
            Hello traderpards,

            I believe that NinjaTrader_Dave has provided a solution to this on another thread: http://ninjatrader.com/support/forum....php?t=79306#4

            Please, let us know if we may be of further assistance.
            Zachary G.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            666 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            377 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            110 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            575 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            580 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X