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 argusthome, 03-08-2026, 10:06 AM
      0 responses
      23 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      20 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      14 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      10 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      41 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X