Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 futtrader, 04-21-2024, 01:50 AM
        6 responses
        57 views
        0 likes
        Last Post futtrader  
        Started by sgordet, Today, 11:48 AM
        0 responses
        1 view
        0 likes
        Last Post sgordet
        by sgordet
         
        Started by Trader146, Today, 11:41 AM
        0 responses
        2 views
        0 likes
        Last Post Trader146  
        Started by jpapa, 04-23-2024, 07:22 AM
        2 responses
        17 views
        0 likes
        Last Post rene69851  
        Started by funk10101, Today, 11:35 AM
        0 responses
        1 view
        0 likes
        Last Post funk10101  
        Working...
        X