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 funk10101, Today, 09:43 PM
      0 responses
      6 views
      0 likes
      Last Post funk10101  
      Started by pkefal, 04-11-2024, 07:39 AM
      11 responses
      37 views
      0 likes
      Last Post jeronymite  
      Started by bill2023, Yesterday, 08:51 AM
      8 responses
      44 views
      0 likes
      Last Post bill2023  
      Started by yertle, Today, 08:38 AM
      6 responses
      26 views
      0 likes
      Last Post ryjoga
      by ryjoga
       
      Started by algospoke, Yesterday, 06:40 PM
      2 responses
      24 views
      0 likes
      Last Post algospoke  
      Working...
      X