Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Add indicator to main price chart vs panel below it?

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

    Add indicator to main price chart vs panel below it?

    I have several indicators in panels below the main pricing chart. This is accomplished successfully with this code:

    AddChartIndicator(Stochastics(stochPeriodD, stochPeriodK, stochSmooth));
    AddChartIndicator(SMA(emaLongLen));
    Panel = 1;
    AddChartIndicator(SMA(emaShortLen));
    Panel = 1;
    AddChartIndicator(ADXR(x,y));
    Panel = 2;
    ClearOutputWindow();

    This gives me 3 subpanels which is perfect. But now I want to add another SMA to the MAIN price chart (above these 3 subpanels). How do I do that? Thanks for helping!

    #2
    Hello jamesmjones00123,

    Thanks for opening the thread.

    The SMA indicator uses IsOverlay = true, so by default it will be plotted on the main price panel without having to specify which panel it should be plotted on.

    Please let us know if we can be of further help.
    JimNinjaTrader Customer Service

    Comment


      #3
      I added a new line at the top, but the new SMA is showing up in the panel below the main pricing panel. Please advise.

      AddChartIndicator(SMA(200));
      AddChartIndicator(Stochastics(stochPeriodD, stochPeriodK, stochSmooth));
      AddChartIndicator(SMA(emaLongLen));
      Panel = 1;
      AddChartIndicator(SMA(emaShortLen));
      Panel = 1;
      AddChartIndicator(ADXR(x,y));
      Panel = 2;
      ClearOutputWindow();

      Comment


        #4
        Hello jamesmjones00123,

        A small detail I overlooked in your code: You are changing the panel of the strategy instead of the Panel property of the indicator.

        I would recommend adding your indicators to your strategy as instances of those indicators, and then to change the Panel property of that indicator. I've attached a demonstration showing how this can be done.

        If there is anything else we can do to assist, please don't hesitate to reach back.
        Attached Files
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by rjbtrade1, 11-30-2023, 04:38 PM
        2 responses
        77 views
        0 likes
        Last Post DavidHP
        by DavidHP
         
        Started by Stanfillirenfro, Today, 07:23 AM
        3 responses
        13 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by FitSpressoHonest, Today, 09:14 AM
        0 responses
        4 views
        0 likes
        Last Post FitSpressoHonest  
        Started by Davide999, 05-18-2023, 03:55 AM
        4 responses
        557 views
        1 like
        Last Post kcwasher  
        Started by rexsole, Today, 08:39 AM
        2 responses
        8 views
        0 likes
        Last Post NinjaTrader_Erick  
        Working...
        X