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

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.
    Emily C.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by AaronKoRn, Today, 09:49 PM
    0 responses
    6 views
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Today, 08:42 PM
    0 responses
    8 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Today, 07:51 PM
    0 responses
    9 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,975 views
    3 likes
    Last Post jhudas88  
    Started by rbeckmann05, Today, 06:48 PM
    0 responses
    9 views
    0 likes
    Last Post rbeckmann05  
    Working...
    X