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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      161 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      308 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      245 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      349 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      179 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X