• 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 swcooke, Yesterday, 10:39 PM
      0 responses
      5 views
      0 likes
      Last Post swcooke
      by swcooke
       
      Started by Fernand0, Yesterday, 09:53 PM
      0 responses
      5 views
      0 likes
      Last Post Fernand0  
      Started by traderpards, Yesterday, 09:55 AM
      4 responses
      24 views
      0 likes
      Last Post Lancer
      by Lancer
       
      Started by franco12364, Yesterday, 06:49 PM
      0 responses
      5 views
      0 likes
      Last Post franco12364  
      Started by fx.practic, Yesterday, 03:55 PM
      0 responses
      1 view
      0 likes
      Last Post fx.practic  
      Working...
      X