Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Autoscale for oscilators, not just drawings...

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

    Autoscale for oscilators, not just drawings...

    Is there a way to turn autoscale off for oscillators that draw 0-100 values?

    I don't mean the autoscale property for drawings on panels. I mean that if I have an oscillator that could range from 0-100 but it's currently always above 60, for example, then 60 becomes the bottom edge of the graph and you have no sense of context. I'd like to see all that blank space from 0 to 60 with the plot over the halfway point in the visual space.

    Make sense? How do I do that?

    #2
    noevictorian, unfortunately changing the scale is not supported in NinjaTrader 6.5, however our upcoming version 7 would offer more options in this regard.

    NinjaTrader 6.5 would scale this dynamically depending on the visible portion on your current osc / chart view...

    Comment


      #3
      Thanks for the reply. Boy am I excited for NT7.

      Comment


        #4
        Can I ask you another question without starting a new thread for it. I've searched the forum and must be using the wrong search terms because I can't imagine it hasn't been asked and answered:

        Can I reference the level of a specific line in a statement? For example I have overbought/oversold lines at 30 and 70... if a user changes these to 90 and 10 in the line configuration settings of the indicator, can I then reference their custom values in logic like this:

        if plot[0] > theirCustomLineValue
        Print("over the line");

        right now I'm hardcoding my if logic but when they change it my logic doesn't match their chart. If they change the line to 90 and my logic is hardcoded:

        if plot[0] > 70
        Print("over the line");

        It's wrong.

        Suggestions? Or should I start a new thread to help others searching for this topic?

        Comment


          #5
          You would just need to define a user defined input level for this custom line, then it would work and be 'picked up' - http://www.ninjatrader-support2.com/...ead.php?t=5782

          Comment


            #6
            Thanks, Josh. I've basically done that. Maybe I should post my code. When I'm back at my desk I'll do just that. Because, yeah I thought it would be that easy but it's not working so I'm clearly screwing something obvious up.

            Thanks

            Comment


              #7
              Ok, please do and we have a look later, thanks

              Comment


                #8
                Okay, so here's the code I'm using...

                In the Properties section I define my public int's:

                [Description("Defines the upper threshold line.")]
                [Category("Lines")]
                public int Overbought
                {
                get { return HighThreshold; }
                set { HighThreshold = Math.Max(50, value); }
                }

                [Description("Defines the lower threshold line.")]
                [Category("Lines")]
                public int Oversold
                {
                get { return LowThreshold; }
                set { LowThreshold = Math.Max(1, Math.Min(49,value)); }
                }


                In the Variables section I define the variables they reference:

                private int HighThreshold = 60; // The level of the overbought line
                private int LowThreshold = 40; // The level of the oversold line

                In the Initialize section I draw the lines:

                Add(new Line(Color.FromKnownColor(KnownColor.Black), Overbought, "Overbought"));
                Add(new Line(Color.FromKnownColor(KnownColor.Black), Oversold, "Oversold"));

                But I must be doing something wrong. Do you see any errors?

                Comment


                  #9
                  Please try changing Initialize() to -

                  Code:
                  Add(new Line(Color.FromKnownColor(KnownColor.Black), HighTreshold, "Overbought"));
                  Add(new Line(Color.FromKnownColor(KnownColor.Black), LowTreshold, "Oversold"));
                  In the Properties -

                  Code:
                   
                  [Description("Defines the upper threshold line.")]
                  [Category("Lines")]
                  public int HighTreshold
                  {
                  get { return highThreshold; }
                  set { highThreshold = Math.Max(50, value); }
                  }
                  
                  [Description("Defines the lower threshold line.")]
                  [Category("Lines")]
                  public int LowTreshold
                  {
                  get { return lowThreshold; }
                  set { lowThreshold = Math.Max(1, Math.Min(49,value)); }
                  }

                  Comment


                    #10
                    Doing that gives me a "does not exist in the current context" error.

                    Do you mean this:

                    Add(new Line(Color.FromKnownColor(KnownColor.Black), HighTreshold, "Overbought"));
                    Add(new Line(Color.FromKnownColor(KnownColor.Black), LowTreshold, "Oversold"));

                    Comment


                      #11
                      Sorry forgot to change that last post... I meant this:

                      Add(new Line(Color.FromKnownColor(KnownColor.Black), highTreshold, "Overbought"));
                      Add(new Line(Color.FromKnownColor(KnownColor.Black), lowTreshold, "Oversold"));

                      Comment


                        #12
                        No, sorry I think my spelling was off causing this -

                        Code:
                         
                        [Description("Defines the upper threshold line.")]
                        [Category("Lines")]
                        public int HighThreshold
                        {
                        get { return highThreshold; }
                        set { highThreshold = Math.Max(50, value); }
                        }
                        
                        [Description("Defines the lower threshold line.")]
                        [Category("Lines")]
                        public int LowThreshold
                        {
                        get { return lowThreshold; }
                        set { lowThreshold = Math.Max(1, Math.Min(49,value)); }
                        }

                        Comment


                          #13
                          Bertrand, I really appreciate the help on this. I'm at a loss. I've attached my code to this post. That might be the fastest way to see what I'm messing up.

                          Incidentally, this current problem version also demonstrates something i posted about yesterday. If you change the value of one of the Overbought/Oversold lines they don't move (which is this current problem) but also the y axis disappears (which I saw yesterday too). Solving the current problem may remedy that erroneous axis behavior, though.

                          Thanks!
                          Attached Files

                          Comment


                            #14
                            noevictorian,

                            You exported your file as a compiled assembly which means we cannot see the code. Please do it as source files for us to be able to view. Thank you.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #15
                              Sorry Josh. Source should be attached here.

                              One area to look into... I've got LinesConfigurable set to false because I don't want to give access to the Lines in two ways: via my property and manually. But maybe that's throwing things off?
                              Attached Files

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              579 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              334 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              101 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              554 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              551 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X