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

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 yertle, Yesterday, 08:38 AM
                7 responses
                28 views
                0 likes
                Last Post yertle
                by yertle
                 
                Started by bmartz, 03-12-2024, 06:12 AM
                2 responses
                21 views
                0 likes
                Last Post bmartz
                by bmartz
                 
                Started by funk10101, Today, 12:02 AM
                0 responses
                4 views
                0 likes
                Last Post funk10101  
                Started by gravdigaz6, Yesterday, 11:40 PM
                1 response
                8 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by MarianApalaghiei, Yesterday, 10:49 PM
                3 responses
                11 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Working...
                X