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 usazencort, Today, 01:16 AM
            0 responses
            1 view
            0 likes
            Last Post usazencort  
            Started by kaywai, 09-01-2023, 08:44 PM
            5 responses
            603 views
            0 likes
            Last Post NinjaTrader_Jason  
            Started by xiinteractive, 04-09-2024, 08:08 AM
            6 responses
            22 views
            0 likes
            Last Post xiinteractive  
            Started by Pattontje, Yesterday, 02:10 PM
            2 responses
            21 views
            0 likes
            Last Post Pattontje  
            Started by flybuzz, 04-21-2024, 04:07 PM
            17 responses
            230 views
            0 likes
            Last Post TradingLoss  
            Working...
            X