• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Is it possible to freeze the y-axis

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

    Is it possible to freeze the y-axis

    The requirement I have is to freeze the y-axis on the chart control and add controls corresponding to the y-axis ticks. Is that possible and if there are any examples, please share.
    Thanks

    #2
    Hello,

    Thank you for the post.

    I wanted to clarify, do you mean to freeze the axis as in how you would when you click and drag on the scale to set it to Fixed scaling? This would entail that the price can move out of the viewable area, is this what you are asking?

    Additionally, by controls do you mean items like buttons or to draw visually?

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Additional control I mean button.

      I want to put a button beside each price. It will be a pain if there is too many values displayed. I want to limit the nos to be 10 and also make sure that the current value is in the viewable area.

      additionally I see min,max and maxminusmin values, but is it possible to get all prices in the viewable area.

      Comment


        #4
        more details

        basically want the current price to be at the center of the axis and the increments are top and bottom of it always. -thanks.

        Comment


          #5
          Hello Subhash Badri,

          Thank you for clarifying your intent.

          I am not aware of any supported or unsupported ways of getting direct control of the price axis or time axis.

          However, it is possible to use an indicator to set the max and min used for the AutoScale for the indicator, and then after applying the indicator to the chart disable the AutoScale for the price bars on the chart in the Data Series window, and use only the indicator for AutoScale. Then you can set the min and max to whatever you would like and this will change the scale of the chart.

          http://ninjatrader.com/support/helpG...lateminmax.htm


          That said, the increments shown appear automatically based on the scale. You can adjust the scale, but not control the increments.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            does not work

            Thanks for the solution, but that does not seem to work.
            But what I have noticed is we can scroll the mouse in the price area and the values comes close to each other with the "F" on top, click which will restore. So it seems to be possible to zoom in values and restrict no. of prices to a defined no.
            eg: if the range is 1 to 10 and if there is only 4 and 4.5 is shown in the viewable area, scrolling shows the price as 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6 etc. so my requirement to have those values as static all the time if the current price is say 3.5.

            Comment


              #7
              Hello Subhash Badri,

              I want to confirm what you are wanting to accomplish. You would like to click a button and have this change the scale on the chart, is this correct?

              Below is a link to a video that demonstrates using a script (MinMaxAutoScaleChangeExample) I have included with this post, to change the scale by setting MinValue and MaxValue in OnCalculateMinMax() .
              https://www.screencast.com/t/KIAAHElIkX

              If this is not what you are trying to accomplish, can you further detail your goal?

              Also, setting the increments is not directly controllable. You would need to find a range on the scale that causes the increments you want to see to automatically appear. (This could be done from the script using OnCalculateMinMax())
              Attached Files
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                This helped a bit, thanks for that.
                since I cannot fix the y-axis, I thought of moving my control adjacent to the current price for which I need to know the position. Is there a way to get the position on the chart panel something like valueByYWpf. Is there an API which takes a control on the graph control panel and returns me the value like valueByYWpf.
                I tried the PointFromScreen, but dont know how to match with the value returned by valueByYWpf.
                thanks.

                Comment


                  #9
                  Hello Subhash Badri,

                  I'm not understanding what you want the position of.

                  Are you asking how to find the position of a panel when there are multiple panels on a chart?

                  chartScale.GetValueByYWpf() is used for converting a mouse position on a monitor to a position on the chart scale. This would only be used when converting monitor related stuff to chart positions.
                  http://ninjatrader.com/support/helpG...aluebyywpf.htm

                  Below is a link to an example indicator that demonstrates this.
                  http://ninjatrader.com/support/forum...684#post499684
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Align the current price and the my button

                    I have placed a button at the center of the chart expecting to freeze the current price on the y-axis to center, but that is not happening even after what you suggested.
                    what I am now planning to do is move the button up and down to match current price. I need to get the position of my button and get current price corresponding to the button position and move the button up/down to match the current price. OR get the point of current price and move the button adjacent to it.
                    which is the easier way and if you have any examples in both the cases please let me know.
                    thanks.

                    Comment


                      #11
                      Hello Subhash Badri,

                      Why are you expecting the button to freeze the current price on the price margin?

                      You are expecting the last price marker to stop moving?

                      Or have your added code to set Min and Max to the highest high in the visible range and lowest low in the visible range?

                      What code have you added?

                      The example I have provided you does not freeze the price margin at the current range or the last price marker. The example I provided you demonstrates how to change the range to a preset 200 as the max and 100 as the min.

                      I was not creating this as a script for you to use, I am providing you a demonstration to show you that changing the range is possible. It would be up to the code in your script to decide on what to use as the top and bottom of the range.
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        move the button

                        somehow I am not able to explain you my requirement or probably I am confusing you.

                        in simple terms:
                        1> I have to put a button beside the current price. and since the current price is moving up/down, I need to move the button up and down. please let me know how to do that?
                        ------------- OR ------------
                        2> I have put an array of buttons beside the y-axis, now I have to identify the button that is beside the current price.
                        with GetYByValueWpf, I get the current price WPF coordinates on the chart.
                        If I can get the WPF coordintates of all the buttons that I have placed, then I can match up with the current price's wpf coordinates. once I select the button then I will use that to do my future development.

                        Thanks,

                        Comment


                          #13
                          Hello Subhash Badri,

                          I think I am understanding.

                          You are wanting to overlay a new layer over the chart and position wpf buttons relative to bars on the chart (specifically to the left of), is this correct?

                          You would need to add a new canvas to the panel and add the buttons to the canvas with absolute positioning using (likely) the same x and y coordinates that are relative to the panel. (You might have to do some math to add / subtract the panel to match the coordinates of the canvas.)
                          And yes, likely you would want to use GetYByValueWpf() to avoid any issues with DPI scaling when converting prices to coordinates.

                          This would not be documented in the NinjaTrader help guide but I was able to find something through a google search you may find helpful.
                          http://stackoverflow.com/questions/3...id-in-xaml-wpf

                          As far as getting a price, this would come from the bar number selected.
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14
                            Not overlaying but inserting

                            Hello,
                            thanks for the response.
                            I am not overlaying a panel, but inserting the buttons using one of the examples shared on the forum
                            this.chartGrid.ColumnDefinitions.Insert((this.tabC ontrolStartColumn + 1),
                            new System.Windows.Controls.ColumnDefinition() { Width = new GridLength(110) });

                            is there an example where you are placing a control in the chart at a particular position either relative or absolute?

                            thanks,
                            Subhash

                            Comment


                              #15
                              I have created an array of buttons wrapped in a stackpanel and inserted into that column.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by stefanjagger, Today, 07:47 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post stefanjagger  
                              Started by tonynt, Today, 07:07 AM
                              1 response
                              4 views
                              0 likes
                              Last Post tonynt
                              by tonynt
                               
                              Started by Marklhc1988, Today, 06:53 AM
                              3 responses
                              10 views
                              0 likes
                              Last Post NinjaTrader_PatrickG  
                              Started by ntbone, Today, 12:05 AM
                              0 responses
                              10 views
                              0 likes
                              Last Post ntbone
                              by ntbone
                               
                              Started by cutzpr, Yesterday, 09:33 PM
                              1 response
                              13 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Working...
                              X