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

Can't display 2 indicators in one?

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

    Can't display 2 indicators in one?

    I made a strategy, and now I'm converting this to an indicator (no order submission of course).

    I see that AddChartIndicator(); is not supported on indicators :/

    So I added this code, which works fine and displays the FIRST indicator, but not the second. What am I missing?

    P.S. - This is for an indicator crossover situation.
    P.S.2 - See attached for the full code.


    Code:
    protected override void OnStateChange() {
      AddPlot(Brushes.Gray, "SHORT_ATR");
      AddPlot(Brushes.Blue, "LONG_ATR");
    }
    
    protected override void OnBarUpdate() {
      SHORT_ATR[0] = ATRTrailing(SHORT_ATRTimes,SHORT_Period,.005)[0];
      LONG_ATR[0] = ATRTrailing(LONG_ATRTimes,LONG_Period,.005)[0];
    }
    
    #region Properties {
    
      [Browsable(false)]
      [XmlIgnore]
      public Series<double> SHORT_ATR
      {
    	get { return Values[0]; }
      }
    
      [Browsable(false)]
      [XmlIgnore]
      public Series<double> LONG_ATR
      {
    	get { return Values[0]; }
      }
    		
    #endregion
    }
    Attached Files

    #2
    Originally posted by jikjol View Post
    I
    you have both as Values[0], change one of them to Values[1].

    in the code, I think this is what you want;;
    // SHORT_ATR[0] = ATRTrailing(SHORT_ATRTimes,SHORT_Period,.005)[0];
    SHORT_ATR[0] = ATRTrailing3[0];
    // LONG_ATR[0] = SMA(LONG_ATRTimes)[0];
    LONG_ATR[0] = ATRTrailing1[0];
    ------------------
    ---
    [Browsable(false)]
    [XmlIgnore]
    public Series<double> LONG_ATR
    {
    get { return Values[1]; }
    }
    Last edited by nkhoi; 01-10-2018, 10:52 PM.

    Comment


      #3
      Hello jikjol,

      Thanks for your post and welcome to the NinjaTrader forums.

      Member nkhoi has provided correct advice for getting the second plot to show.
      Paul H.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by rhyminkevin, Today, 04:58 PM
      3 responses
      47 views
      0 likes
      Last Post Anfedport  
      Started by iceman2018, Today, 05:07 PM
      0 responses
      5 views
      0 likes
      Last Post iceman2018  
      Started by lightsun47, Today, 03:51 PM
      0 responses
      7 views
      0 likes
      Last Post lightsun47  
      Started by 00nevest, Today, 02:27 PM
      1 response
      14 views
      0 likes
      Last Post 00nevest  
      Started by futtrader, 04-21-2024, 01:50 AM
      4 responses
      50 views
      0 likes
      Last Post futtrader  
      Working...
      X