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 charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      72 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      152 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      162 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      100 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      288 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X