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

Indicator panel in strategy script

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

    Indicator panel in strategy script

    Hi NT,

    I am plotting an indicator via a strategy - how do I tell it which 'panel' to plot on ?
    I am using the following in State.DataLoaded

    Code:
    				ATRplot = ATR(200);
    				ATRplot.Plots[0].Brush = Brushes.Green;
    				ATRplot.Plots[0].Width = 2;
    				AddChartIndicator(ATRplot);
    								
    				ROCplot = ROC(5);
    				ROCplot.Plots[0].Brush = Brushes.Blue;
    				ROCplot.Plots[0].Width = 2;
    				AddChartIndicator(ROCplot);
    				
    				BollROCplot = Bollinger(ROC(5),1.5,200);
    				BollROCplot.Plots[0].Brush = Brushes.Gold;
    				BollROCplot.Plots[0].Width = 2;
    				AddChartIndicator(BollROCplot);
    The ATR plots just fine in its own panel.
    The ROC plots just fine in its own panel.
    The Bollinger plots in the price pane (which is not fine for me but is expected behaviour I guess).

    How do I plot Bollinger Bands around ROC (Bollinger(ROC(5),1.5,200) on the same panel from a strategy Script ?

    Thanks

    AK

    #2
    Hello akvevo,

    You could use the following,

    Code:
    ROCplot.Panel=2;
    BollROCplot.Panel=2;
    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Hi,

      One follow up question here if I may,
      Id like to colour my bollinger bands (upper, lower, average) in a Gold for instance.
      The code below plots my bollinger bands on in its own panel, but the BollROCplot.Plots[0].Brush = Brushes.Gold; line only colours the Upper bollinger band.
      My variable is Bollinger, and I havent asked it to colour the upper bank only.
      How can I colour all 3 bands in the same colour please?


      Code:
      private Bollinger BollROCplot;
      ...
      BollROCplot = Bollinger(ROC(5),1,60);
      BollROCplot.Plots[0].Brush = Brushes.Gold;
      BollROCplot.Plots[0].Width = 2;
      BollROCplot.Panel=2;
      AddChartIndicator(BollROCplot);
      Thanks you

      Comment


        #4
        Hello akvevo,

        To set the color of each plot you could use the following,
        Code:
        Plots[0].Brush = Brushes.Gold;
        Plots[1].Brush = Brushes.Gold;
        Plots[2].Brush = Brushes.Gold;
        With your example you could try,

        Code:
        BollROCplot.Plots[0].Brush = Brushes.Gold;
        BollROCplot.Plots[1].Brush = Brushes.Gold;
        BollROCplot.Plots[2].Brush = Brushes.Gold;
        See the plots section of the helpguide,


        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Hello,

          I have the same problem with Bollinger bands (calculated with SRSI indicator but displayed in the upper part of the chart, with quotes). Following (?) your advise, i've tried to insert xxx.panel=2 but it does not work.

          AddChartIndicator(amaSuperTrendU112);
          amaSRSI1 = amaSRSI(Close, Convert.ToInt32(SRSI_EMA_dur), Convert.ToInt32(SRSI_RSI_dur), 10);
          amaSRSI2 = amaSRSI(Close, Convert.ToInt32(SRSI_EMA_dur), Convert.ToInt32(SRSI_RSI_dur), 10);
          amaSRSI2.Plots[0].Brush = Brushes.Blue;
          amaSRSI2.Plots[1].Brush = Brushes.Red;
          amaSRSI2.Panel=2;
          AddChartIndicator(amaSRSI2);
          Bollinger1 = Bollinger(amaSRSI2.SlowRSI, BB_STD_nbre, Convert.ToInt32(BB_MM_dur));
          Bollinger1.Plots[0].Brush = Brushes.LimeGreen;
          Bollinger1.Plots[1].Brush = Brushes.Transparent;
          Bollinger1.Plots[2].Brush = Brushes.LimeGreen;
          Bollinger1.Panel=2;
          AddChartIndicator(Bollinger1);
          Thanks for help.

          Comment


            #6
            Hello Alf63,

            Could you please provide more information on what is not working? What are you seeing vs what are you expecting?

            I have attached a strategy which adds two SMA's, in 2 different panels as a sample.,

            I look forward to your reply.
            Attached Files
            Alan P.NinjaTrader Customer Service

            Comment


              #7
              Hello Alan,

              Thanks for answer.

              I have a chart with 2 panels. In the fisrt panel, quotes are displayed. In the second panel, below, i have a slow RSI. I calculate Bollinger bands using slow RSI as input serie so i want Bollinger bands to be in the second panel, with slow RSI. I see Bollinger bands in panel 1, with quotes.

              I've tried your example/strategy but it does not work, i cannot manage to display Bollinger bands in panel 2 (with slow RSI).

              Alain

              Comment


                #8
                Hello Alf63,

                I am able to plot Bollinger Bands over an RSI, see screen shot.

                If you'd like to upload sample code I can take a look and see if anything jumps out. Please use the following format.

                To export a NinjaScript from NinjaTrader 8 do the following:
                From the Control Center window select Tools -> Export -> NinjaScript...
                Click Add>Select the indicator>OK>Export.
                Then attach that file you saved; under My Docs>NT8>Bin>Custom>Select the downloaded .zip file.

                Please let us know if you need further assistance.
                Attached Files
                Alan P.NinjaTrader Customer Service

                Comment


                  #9
                  Hello Alan,

                  I've erased the strategy (i made so many mistakes...). As soon as i can, i'll build it again and i'll try to follow exactly the code in your screenshot for panels.

                  Thanks.

                  Alain

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by jaybedreamin, Today, 05:56 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post jaybedreamin  
                  Started by DJ888, 04-16-2024, 06:09 PM
                  6 responses
                  18 views
                  0 likes
                  Last Post DJ888
                  by DJ888
                   
                  Started by Jon17, Today, 04:33 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post Jon17
                  by Jon17
                   
                  Started by Javierw.ok, Today, 04:12 PM
                  0 responses
                  12 views
                  0 likes
                  Last Post Javierw.ok  
                  Started by timmbbo, Today, 08:59 AM
                  2 responses
                  13 views
                  0 likes
                  Last Post bltdavid  
                  Working...
                  X