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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      77 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      63 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      63 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Working...
      X