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 I draw lines in the indicator window?

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

    Can I draw lines in the indicator window?

    can I use 'Drawline', 'DrawRay' or another method to draw trendlines in the indicator window instead of the main pricechart?

    #2
    Yup. Set DrawOnPricePanel to false in the Initialize() method.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Great!
      Sorry I overlooked this before...

      Can I also do both at the same time?
      Like first set DrawOnPricePanel = true and draw the lines in the pricechart, and then make DrawOnPricePanel = false and draw lines in the indicator panel.
      I'll try anyway.

      Comment


        #4
        Unfortunately not within the same indicator.
        RayNinjaTrader Customer Service

        Comment


          #5
          I tried to plot on the price panel and Draw in an indicator panel. However, both plots go to the price panel. Here is what I coded!
          protected override void Initialize()
          {
          Add(new Plot(new Pen(Color.Red,3), PlotStyle.Line, "Fast"));
          Add(new Plot(new Pen(Color.Yellow,3), PlotStyle.Line, "Slow"));

          BarsRequired = 60;
          DrawOnPricePanel = false;
          CalculateOnBarClose = false;
          Overlay = true;
          PriceTypeSupported = false;
          Diff = new DataSeries(this);
          protected override void OnBarUpdate()
          {


          Fast.Set(PMATrace(pMAFastER,pMAFastSens)[0]);
          Slow.Set(PMATrace(pMASlowER,pMASlowSens)[0]);
          if (CurrentBar >= BarsRequired)
          {
          DiffC = PMATrace(pMASlowER,pMASlowSens)[0] - PMATrace(pMAFastER,pMAFastSens)[0];
          Print(DiffC);
          Diff.Set(DiffC);
          DrawLine("Tag1"+CurrentBar,true,1,Diff[1],0,Diff[0],Color.Green,DashStyle.Solid,4);
          }
          }

          Comment


            #6
            Reload the indicator on your chart ensuring that the Panel # is not equal to a value of 1. This will create a new indicator panel. As coded, your indicator will draw the line on the indicator panel itself.
            RayNinjaTrader Customer Service

            Comment


              #7
              Could you explain what you mean by:
              "ensuring that the Panel # is not equal to a value of 1"

              With this code the Draw is on the price panel no mater what I set
              DrawOnPricePanel to.

              Is there a setting for the Panel #? If so where do I locate it?

              Comment


                #8
                When you load the indicator you can choose which panel to place the indicator on. The option is in the indicator dialog window on the right hand side.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  I am trying to Plot on the Price Panel and have the Draw appear in the indicator window Panel =1.

                  Checked and the Panel is set to 1 when the indicator is added to a chart.

                  The values for the Draw are quite small so:

                  When I set Overlay = true; the plot and data are scrunched up at the top of the price panel and I get a line at 0 for the plot.

                  When I set Overlay = false; the plot is placed in a indicator panel and again the data is scrunched at the top of the price panel and the Draw is plotted along the 0 line.

                  Does not make any difference what the value of
                  DrawOnPricePanel is set to.

                  I thought the DrawOnPricePanel would direct the Draw to either the price panel or an indicator panel. It seams not to change anything when I change its setting.

                  Can you have a custom indicator display in the price panel and the Draw display in the indicator panel? This is the reverse from the documentation.

                  Comment


                    #10
                    Unfortunately it won't work that way. Panel 1 is the same as the price panel. If you have your indicator on panel 1 and set DrawOnPricePanel to false it will continue to draw on the price panel because the indicator panel your indicator is on is the price panel.

                    You will need to place your indicator on Panel 2 or higher in order to have the DrawOnPricePanel variable take any effect.

                    To prevent scrunching you will want to turn AutoScale to false.

                    A workaround to achieve what you want is maybe to just create two indicators. One that plots what you want on the price panel and one that draws on an indicator panel.
                    Josh P.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by GussJ, 03-04-2020, 03:11 PM
                    15 responses
                    3,270 views
                    0 likes
                    Last Post xiinteractive  
                    Started by Tim-c, Today, 02:10 PM
                    1 response
                    8 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by Taddypole, Today, 02:47 PM
                    0 responses
                    2 views
                    0 likes
                    Last Post Taddypole  
                    Started by chbruno, 04-24-2024, 04:10 PM
                    4 responses
                    51 views
                    0 likes
                    Last Post chbruno
                    by chbruno
                     
                    Started by TraderG23, 12-08-2023, 07:56 AM
                    10 responses
                    403 views
                    1 like
                    Last Post beobast
                    by beobast
                     
                    Working...
                    X