Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator Base Classes

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

    Indicator Base Classes

    I have created some base classes, that are derived from Indicator, to avoid code duplication. I wasn't able to make them abstract, but could make them virtual. The issue is that the base classes appear in the Indicators list. I could just duplicate the source code, but I naturally want to avoid that if I can.

    Thanks,
    Henry

    #2
    Hello Henry,

    Inheritance for indicators is not supported by NinjaTrader and can cause issues with the auto-generated code added by NinjaTrader.

    You could have static methods in a custom namespace and call the methods from indicators or strategies, and this would not cause issues with this.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      My base classes make use of protected class fields, properites and some abstract/virtual methods. What I'll do is duplicate the source code, but put it into a region so it is easy to identify and remove if Inheritence for indicators is ever supported. That would also make it easier to maintain for me as I will just copy and paste any modifications to what would ideally be the source code for the base class into the classes that use it.

      Thanks,
      Henry

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      86 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      124 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      64 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      115 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      67 views
      0 likes
      Last Post PaulMohn  
      Working...
      X