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

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 ttrader23, 05-08-2024, 09:04 AM
      9 responses
      42 views
      0 likes
      Last Post ttrader23  
      Started by ZeroKuhl, Yesterday, 04:31 PM
      8 responses
      43 views
      0 likes
      Last Post ZeroKuhl  
      Started by reynoldsn, Today, 07:04 PM
      0 responses
      8 views
      0 likes
      Last Post reynoldsn  
      Started by puapwr, Today, 06:09 PM
      0 responses
      4 views
      0 likes
      Last Post puapwr
      by puapwr
       
      Started by franciscog21, Today, 05:27 PM
      0 responses
      13 views
      0 likes
      Last Post franciscog21  
      Working...
      X