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 ETFVoyageur, Today, 04:00 PM
      2 responses
      9 views
      0 likes
      Last Post ETFVoyageur  
      Started by dward123, 01-02-2024, 09:59 PM
      3 responses
      162 views
      0 likes
      Last Post bjunaid
      by bjunaid
       
      Started by AaronKTradingForum, Today, 03:44 PM
      1 response
      8 views
      0 likes
      Last Post AaronKTradingForum  
      Started by Felix Reichert, 04-26-2024, 02:12 PM
      11 responses
      77 views
      0 likes
      Last Post Felix Reichert  
      Started by junkone, 04-28-2024, 02:19 PM
      7 responses
      83 views
      1 like
      Last Post junkone
      by junkone
       
      Working...
      X