Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator hosting another indicator

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

    Indicator hosting another indicator

    Hi there,

    I am writing an Indicator, which is using (hosting) another indicator ... I want the hosted indicator to also Plot, however this doesn't happen.

    (it works when it is a Strategy hosting an Indicator, once Add() is used onto the hosted indicator ... but I cannot get Add() to accept another Indicator from inside the hosting Indicator).

    Thanks

    public class UsePlotInput : Indicator
    {
    #region Variables
    // Wizard generated variables
    // User defined variables (add any user defined variables below)
    #endregion

    /// <summary>
    /// This method is used to configure the indicator and is called once before any bar data is loaded.
    /// </summary>
    protected override void Initialize()
    {
    Add( SMA( Close, 20) ); // this doesn't compile ... but without it it doesn't plot the SMA

    Overlay = true;
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // Use this method for calculating your indicator values. Assign a value to each
    // plot below by replacing 'Close[0]' with your own formula.

    SMA( Close, 20);
    }

    }

    #2
    dom,

    With indicators, you would need to create a plot and set it to the indicator value if you would like to see the plots. The Add() method will only allow an indicator to plot through a strategy the method you are using.

    Please let me know if I may assist further.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Fair enough (& I understand the rationale for it), thanks

      Comment

      Latest Posts

      Collapse

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