• 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

Indicator inheritance that worked in NT 7 doesn't work in NT 8

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

    Indicator inheritance that worked in NT 7 doesn't work in NT 8

    In NT 7 I could do:

    Code:
    IndicatorBase : Indicator {} 
    
    IndicatorA : IndicatorBase {} 
    
    IndicatorB : IndicatorA {}
    In NT8 it works for IndicatorBase and IndicatorA but for IndicatorB it does not generate the "region NinjaScript generated code. Neither change nor remove." section.

    It's just blank at the bottom of the IndicatorB file and I can't get it to make the code. IndicatorA and IndicatorBase both have the code and work, but IndicatorB can't be used.

    #2
    Hello meinl,

    Thank you for your post.

    I see behavior that is a bit different. The second and third scripts do not generate the NS generated section but I can use them both on a chart.

    I have attached my three indicators, which do nothing at all but can be added to the chart. May we test your scripts? Or can you provide details on what they do in the code? Such as Plots, calculations, etc.
    Attached Files
    Patrick H.NinjaTrader Customer Service

    Comment


      #3
      It looks like there's no generated code in the above example files. They do compile and can plot hard coded values but the problem I'm running into is that because there is no generated code, there's no way to do something like:

      Indicator i=Test2(1, 1);

      That is, if you add a [NinjaScriptProperty] to Test1 and Test2, then Test2 should have a constructor that reads from the indicator cache like the regular indicators.

      As it is, you have to do Test2 test2=new Test2(); and then set the properties separately, and maintain your own cache of derived indicators so things aren't getting recomputed when used by multiple points of the code.

      It also means that the test2 indicator will not be getting automatically updated by NT as data comes in, you'll have to somehow set the input data series and then manually update the indicator from all the other indicators that use it, and make sure none of them are giving it the same data twice.

      The generated code takes care of that, so it looks like without the generated code it's much easier to never use more than one layer of inheritance and use a has-a relationship instead.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by digibob, Today, 02:47 AM
      2 responses
      13 views
      0 likes
      Last Post NinjaTrader_Kate  
      Started by mntemel, Today, 03:31 PM
      3 responses
      12 views
      0 likes
      Last Post NinjaTrader_JoshG  
      Started by mrlucky1x, Today, 03:14 PM
      1 response
      3 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Started by ninjo, Today, 02:42 PM
      3 responses
      8 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by Longhornmark, Today, 01:13 PM
      7 responses
      21 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Working...
      X