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

Line Plot

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

    Line Plot

    I am trying to plot a constant line at 3 and -3 on a panel. this is what I have:

    Add(new Plot(Color.Transparent, PlotStyle.Line, "Plot8")); // Plot 8
    Add(new Plot(Color.Transparent, PlotStyle.Line, "Plot9")); // Plot 9
    Plot8.Set(3); // Make Oscillator Scale constant at 3 on average
    Plot9.Set(-3); // Make Oscillator Scale constant at -3 on average

    I keep getting an error that:

    The name Plot8 does not exist in the current context
    The name Plot9 does not exist in the current context

    Where am I going wrong?


    #2
    Hi velocity, are the associated dataseries added in the properties for Plot8 and Plot9?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      i added the following

      [Browsable(false)]
      [XmlIgnore()]
      public DataSeries Plot8
      {
      get { return Values[8]; }
      }

      [Browsable(
      false)]
      [XmlIgnore()]
      public DataSeries Plot9
      {
      get { return Values[9]; }
      }

      But, it does not work. the scale will go to +1/-1 if the oscillator's values are between +1 and -1. However I want the scale to be +3 amd -3 even if the values are between +1 and -1

      Any thoughts as to where I am going wrong?

      Comment


        #4
        Hi velocity, unfortunately changing the scale is not supported at this time - have you tried working with Min and Max as in this tutorial?http://www.ninjatrader-support.com/H...ionLogic3.html
        BertrandNinjaTrader Customer Service

        Comment


          #5
          that is what i thought too. However, if I place a constant value as an idicator and make it transparent, I was trying to fake NT out so the scale would adjust.

          Any thoughts?

          Comment


            #6
            velocity,

            Not supported at this point in time. If you want to "fake" it out, don't use a transparent color.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              OK. I changed everything to the following and now I do not get any plots, what's wrong here?

              Add(new Plot(Color.Black, PlotStyle.Line, "Plot8")); // Plot 8
              Add(new Plot(Color.Black, PlotStyle.Line, "Plot9")); // Plot 9
              Plot8.Set(3); // Make Oscillator Scale constant at 3 on average
              Plot9.Set(-3); // Make Oscillator Scale constant at -3 on average
              Plots[8].Max = 3;
              Plots[
              9].Min =-3;

              Comment


                #8
                Don't set your plots inside Initialize(). Do it inside OnBarUpdate().
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  that did it, thank you

                  Comment


                    #10
                    Hi,

                    A similar question from me:

                    In my strategy Initialize() section, I have included

                    Add(Stochastics(7,14,3))

                    in the code.

                    When running the strategy, the stochastics panel appears as desired; however, it has the "standard" channel lines at 20 and 80. How do I change those values to 30 and 70, for example? Something like

                    Add(Stochastics(7,14,3),UpLine = 70,DownLine = 30) would be great...

                    Thanks for helping!

                    Comment


                      #11
                      Unfortunately this is not possible without custom coding, as you can only Add() full indicators, not specific plots of indicators.
                      BertrandNinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by rdtdale, Today, 01:02 PM
                      0 responses
                      2 views
                      0 likes
                      Last Post rdtdale
                      by rdtdale
                       
                      Started by alifarahani, Today, 09:40 AM
                      3 responses
                      15 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Started by RookieTrader, Today, 09:37 AM
                      4 responses
                      18 views
                      0 likes
                      Last Post RookieTrader  
                      Started by PaulMohn, Today, 12:36 PM
                      0 responses
                      7 views
                      0 likes
                      Last Post PaulMohn  
                      Started by love2code2trade, 04-17-2024, 01:45 PM
                      4 responses
                      41 views
                      0 likes
                      Last Post love2code2trade  
                      Working...
                      X