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 traderqz, Yesterday, 09:06 AM
        2 responses
        15 views
        0 likes
        Last Post traderqz  
        Started by traderqz, Today, 12:06 AM
        3 responses
        6 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by RideMe, 04-07-2024, 04:54 PM
        5 responses
        28 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by f.saeidi, Today, 08:13 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by DavidHP, Today, 07:56 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Erick  
        Working...
        X