Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding 2 indicators to the same panel using AddChartIndicator in Strategy

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

    Adding 2 indicators to the same panel using AddChartIndicator in Strategy

    Hi

    I'm using below code in State.DataLoaded:

    Code:
    EMA1 = EMA(emaPeriod);
                    Bollinger1 = Bollinger(bollingerNoStdDev, bollingerPeriod);
                    DoubleStochastics1 = DoubleStochastics(doubleStoPeriod);
                    Stochastics1 = Stochastics(stoPeriodD, stoPeriodK, stoSmooth);
    
                    if (showIndicators)
                    {
                        AddChartIndicator(EMA1);
                        AddChartIndicator(Bollinger1);
                        AddChartIndicator(DoubleStochastics1);
                        AddChartIndicator(Stochastics1);
                    }​
    I would like the DoubleStochastics and Stochastics indicators to be shown in the same panel. How do I do that please?

    Thanks
    Tim

    #2
    Hello Tim,

    Thank you for your post.

    You should be able to access the Panel property before calling AddChartIndicator() in order to put the DoubleStochastics and Stochastics in the same panel. Using your snippet, this could look like the following:
    Code:
    EMA1 = EMA(emaPeriod);
    Bollinger1 = Bollinger(bollingerNoStdDev, bollingerPeriod);
    DoubleStochastics1 = DoubleStochastics(doubleStoPeriod);
    Stochastics1 = Stochastics(stoPeriodD, stoPeriodK, stoSmooth);
    DoubleStochastics1.Panel = 2;
    Stochastics1.Panel = 2;
    
    if (showIndicators)
    {
    AddChartIndicator(EMA1);
    AddChartIndicator(Bollinger1);
    AddChartIndicator(DoubleStochastics1);
    AddChartIndicator(Stochastics1);
    }​
    For more information, including another sample script demonstrating this idea, please see the following post from a similar thread:
    Hi All I am trying to plot 2 CCI in the same panel IE panel 2 these 2 are part of a strategy and when I use addchartindicator they need to plot in same Panel any ideas could help as I searched everywhere and didnt find a solution Thank you in advance Richard


    Please let us know if we may be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    47 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    22 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    33 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X