Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

auto scale for indicator

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

    auto scale for indicator

    hi all,

    Say I have an indicator, that plots several lines all within the range of 2000-2200. When I add it to a chart, it opens in a new panel. The right access starts at 0 and goes all the way up to 2500. So initially, the lines are all bunched together. I then can manually adjust the scale so that the right side displays 1900-2500 and then I can see the separate lines. Hope this makes sense.

    Is there a setting that I can set that does this automatically? that will scale the panel based on the values on the visual area of chart?

    - Onn

    #2
    There is an indicator in the file sharing that will help.
    I hacked it up for my battery level indicator for 0-100 scale.

    Comment


      #3
      Originally posted by onnb1 View Post
      hi all,

      Say I have an indicator, that plots several lines all within the range of 2000-2200. When I add it to a chart, it opens in a new panel. The right access starts at 0 and goes all the way up to 2500. So initially, the lines are all bunched together. I then can manually adjust the scale so that the right side displays 1900-2500 and then I can see the separate lines. Hope this makes sense.

      Is there a setting that I can set that does this automatically? that will scale the panel based on the values on the visual area of chart?

      - Onn
      You can set "AutoScale" for that indicator to true. If you superimpose it to a second inidcator, then set it to "Overlay".

      Comment


        #4
        Hello onnb1,

        Thanks for your post.

        You can set the alignment of an indicator with ScaleJustification.

        For example:
        ScaleJustification = ScaleJustification.Left;

        For added indicators to a strategy you can also set these.
        For example:
        Add(SMA(19));
        SMA(19).ScaleJustification = ScaleJustification.Left;

        http://www.ninjatrader.com/support/h...tification.htm
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          thanks for all the replies. I understand that the scale justification would come into play if I was using overlay as Harry mentions.

          I am sorry to have waster your time but I think I found the "problem". One of my plots is set as a Bar. It happens that all the values for that plot are N/A. I am guessing that regardless of the N/A, just because it is a bar, NT will start the scale at zero. When I remove that specific plot, the panel basically displays automatically as I would expect it to.

          If that is true, my 2 cents to NT is that if a plot has N/A's, it should not be taken into account when scaling.

          Onn

          Comment


            #6
            Hi onnb1,

            I think it may be possible to accomplish this with code.

            For example:

            in Initialize():
            Add(new Plot(Color.Blue, "myplot"));
            AutoScale = false;

            in OnBarUpdate():
            Value.Set(myIntHere)
            if (myIntHere > 0)
            {
            AutoScale = true;
            }
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              I tried setting autoscale to true in the initialize section. It did not help. Is there any reason you have it set that way in OnBarUpdate?

              Onn

              Comment


                #8
                Hello Onn,

                After making AutoScale set to false in the Initialize section, you will need to remove the indicator from the chart, and the re-add it.
                • Right-click the chart -> select Indicators....
                • Select the indicator from the list of active indicators on the bottom left -> click the Remove button
                • Click Apply
                • Select the indicator from the master list on the top left -> click the Add button
                • Click OK


                The proposed changes will keep the autoscale false by default, then when the value of the line is greater than 0 it will change this to true.

                Is this what you were looking for?
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                577 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
                553 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