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 geddyisodin, Yesterday, 05:20 AM
      8 responses
      49 views
      0 likes
      Last Post geddyisodin  
      Started by DayTradingDEMON, Today, 09:28 AM
      3 responses
      19 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by Stanfillirenfro, Today, 07:23 AM
      9 responses
      23 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by George21, Today, 10:07 AM
      0 responses
      8 views
      0 likes
      Last Post George21  
      Started by navyguy06, Today, 09:28 AM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X