Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Your Object Model

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

    Your Object Model

    In my class I want to call the built-in Add() method. However, that method is a protected member function of IndicatorBase. If I specify that my class is derived from indicator base NT also wants me to define Initialize() and OnBarUpdate(). Can I go ahead and do so, defining them thus:

    protected override void Initialize() {}
    protected override void OnBarUpdate() {}

    That is, effectively as no-ops, or will this hide the implementation in my indicator?

    Thks.

    #2
    Unfortunately we don't support the creation of custom classes (it is possible just not supported).

    Might I ask what your end goal here is so I can possibly provide a work around or alternative solution?

    Is there a reason you can't create a new indicator and then perform the desired operations with in the indicator? Doing this would allow you access to using the Add() in Initialize()
    LanceNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Lance View Post
      Unfortunately we don't support the creation of custom classes (it is possible just not supported).

      Might I ask what your end goal here is so I can possibly provide a work around or alternative solution?

      Is there a reason you can't create a new indicator and then perform the desired operations with in the indicator? Doing this would allow you access to using the Add() in Initialize()
      http://www.ninjatrader.com/support/h....html?add3.htm
      Thanks for your reply Lance. I create a class in my custom indicator. In the constructor I want to add the security name passed in the constructor to a chart and also plot it. So I want to call, for example,

      Add("SPY", PeriodType.Day, 1);
      Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "Plot1"));

      in my constructor. As I am creating a portfolio of several of these securities it good to encapsulate the calls a function call (the constructor).

      Comment


        #4
        Thanks for this information.

        The only supported way we would have to do this would be to hard code Add() all the instruments in the Initialize() of the indicator.

        This is because Initialize() can get called at times other than what you might expect. For example, opening up the indicators window can cause Initialize() to be called. If these series are not hard coded the series may not be added properly.

        Let me know if you think I misunderstood your request.
        LanceNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        571 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        330 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        549 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        549 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X