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

chartscale property (fixed) via c# code

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

    chartscale property (fixed) via c# code

    Hello, is it possible to call the chartscale property (fixed) via c# code?

    Click image for larger version

Name:	Screenshot_1.jpg
Views:	281
Size:	14.0 KB
ID:	1183377

    currently I reset the fixed scalling with the following code:

    Code:
    _chartScale.Properties.YAxisRangeType = YAxisRangeType.Automatic;
    But I would just like to use the existing property on the chart and would have to address the property for that.
    Attached Files
    sidlercom80
    NinjaTrader Ecosystem Vendor - Sidi Trading

    #2
    Hello sidlercom80,

    Thanks for your post.

    I am not not exactly sure what you are trying to accomplish differently. We have the NinjaScript object's AutoScale property, and we have the Fixed/Automatic scaling property for the ChartScale. Changing the ChartScale Fixed/Automatic scaling programmatically would be how you demonstrate in your snippet.

    Setting a fixed scale programmatically would look like:

    Code:
    chartScale.Properties.FixedScaleMin = 0;
    chartScale.Properties.FixedScaleMax = 100;
    chartScale.Properties.YAxisRangeType = YAxisRangeType.Fixed;
    Could you elaborate on what you want to do differently if this does not answer your question?
    JimNinjaTrader Customer Service

    Comment


      #3
      Hi _Jim, thank you for your reply.
      In my script, the YAxisRangeType = YAxisRangeType.Fixed is set when I move the chart with the mouse button pressed. Then I currently have to switch back to YAxisRangeType = YAxisRangeType.Automatic via key because the button is not displayed in the chart. I should be able to activate the button when I move the chart.

      I made a short video: http://www.youtube.com/watch?v=rxsloJuCugM
      sidlercom80
      NinjaTrader Ecosystem Vendor - Sidi Trading

      Comment


        #4
        Hello sidlercom80,

        Thanks for clarifying.

        This looks like it would be a limitation of how the Fixed/Automatic scaling button gets added to the chart, and since the ChartScale properties are intended to be modified by the user. While we can modify them programmatically, we do get this issue with the Fixed/Automatic button not appearing when doing so. (ChartScale Properties note that these are UI properties intended to be set by the user.)

        Since the script is overriding the scaling by writing its own fixed scale, you could consider adding your own button to disable the forced Fixed scaling and revert back to Automatic. This may not be ideal, but may be worth considering.

        JimNinjaTrader Customer Service

        Comment


          #5
          Hi _Jim, I almost thought so ;-) the button I have no problem. How do I get the button on the same place in the chartscale and not in the menu?

          it doesn't work that way;
          Code:
          ChartPanel.Scales.Add(btnFixScale);
          sidlercom80
          NinjaTrader Ecosystem Vendor - Sidi Trading

          Comment


            #6
            Hello sidlercom80,

            I would have gone with adding a small button to UserControlCollection. that would reside in the very upper right corner, and still outside of the "Scroll to last bar" arrow.

            Rendering is clipped to be within the ChartPanel and outside of the price scale, and UserControlCollection binds controls to be within the ChartPanel with the same rules. I don't have any suggestions to share to add anything to the price scale space on the chart.
            JimNinjaTrader Customer Service

            Comment


              #7
              Hi _Jim, is there also a property for querying the status from Fixed/Automatic scaling button, as with ChartControl.IsScrollArrowVisible?
              sidlercom80
              NinjaTrader Ecosystem Vendor - Sidi Trading

              Comment


                #8
                Hello sidlercom80,

                There wasn't anything I saw for that purpose. I also had a look with the Windows Inspect tool to see if there was an Automation ID that could be used to find the button and check its visibility, and there wouldn't be anything to use there.

                Adding your own "Return to AutoScale" button can be shown if (chartScale.Properties.YAxisRangeType == YAxisRangeType.Fixed) There may be cases where NinjaTrader's "Return to AutoScale" button appears when a user changes the property through the UI, and your script will also show its button. I don't think there would be a way around this scenario.
                JimNinjaTrader Customer Service

                Comment


                  #9
                  Thank you _Jim for your work! That would have been too easy ;-) I will keep trying.
                  sidlercom80
                  NinjaTrader Ecosystem Vendor - Sidi Trading

                  Comment


                    #10
                    Hi _Jim, I made my own "F" button and have one last question ;-) can the original symbol be switched off or overwritten so that it is no longer visible on the chart?
                    sidlercom80
                    NinjaTrader Ecosystem Vendor - Sidi Trading

                    Comment


                      #11
                      Hello sidlercom80,

                      What do you mean by "the original symbol?" If you are referring to NinjaTrader's "F" button, I do not have any suggestion for finding/hiding this button.
                      JimNinjaTrader Customer Service

                      Comment


                        #12
                        Hi _Jim, yes, that's exactly what I meant. Too bad that there is no solution for this, but thank you for your help!
                        sidlercom80
                        NinjaTrader Ecosystem Vendor - Sidi Trading

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by cre8able, 02-11-2023, 05:43 PM
                        3 responses
                        235 views
                        0 likes
                        Last Post rhubear
                        by rhubear
                         
                        Started by frslvr, 04-11-2024, 07:26 AM
                        8 responses
                        113 views
                        1 like
                        Last Post NinjaTrader_BrandonH  
                        Started by stafe, 04-15-2024, 08:34 PM
                        10 responses
                        44 views
                        0 likes
                        Last Post stafe
                        by stafe
                         
                        Started by rocketman7, Today, 09:41 AM
                        3 responses
                        11 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Started by traderqz, Today, 09:44 AM
                        2 responses
                        10 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Working...
                        X