Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ToolBar Button for Indicator Show/Hide

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

    #16
    Hi Kate,

    Thank you for your reply,

    Your suggestion will hide or show all drawings including the drawings made from any indicator, thank you for it.
    Now, what I need is to hide or show the drawings made from the "TrendLines" indicator only.
    I'm applying your suggestion to the "TrendLines" indicator zone script, but I have the same results.

    Here is the code with the problem hiding or showing the "TrendLines" indicator:
    Code:
    private void btnTrendLinesClick(object sender, RoutedEventArgs e)
    {
    System.Windows.Controls.Button button = sender as System.Windows.Controls.Button;
    if (button != null)
    {
    // toggle TrendLines indicator
    foreach (var obj in chartWindow.ActiveChartControl.ChartObjects)
    {
    var indi = obj as TrendLines;
    if (indi != null)
    {
    if (indiSwitch)
    {
    indi.IsVisible = false;
    indiSwitch = true;
    //Print(indiSwitch + "' is hidden.");
    }
    else if (!indiSwitch)
    {
    indi.IsVisible = true;
    indiSwitch = false;
    //Print(indiSwitch + "' is visible.");
    }
    }
    }
    indiSwitch = !indiSwitch;
    chartWindow.ActiveChartControl.InvalidateVisual();
    ForceRefresh();
    }
    }
    Thank you!

    Comment


      #17
      Hello joselube001,

      Thank you for your reply.

      The Trend Lines indicator creates it's line using drawing tools. The IsVisible setting simply prevents the script from processing. So rendered objects like plots or custom renders are not rendered because OnRender is never called. However, this does not cause existing drawing tool objects already drawn by the script to be removed from the chart or any other actions to occur, so toggling IsVisible will not work. One thing to try is looping through the drawing tools and checking to see if the drawing object found has a tag name that starts with "Trend line". If it does, then toggle that object's IsVisible property.

      However, I have added a vote for you to an existing SFT to Remove/Re-add drawing objects that were drawn by indicators from the chart based on the indicator's IsVisible settings. This request is being tracked under the number SFT-4021.

      As with all feature requests, interest is tracked before implementation is considered, so we cannot offer an ETA or promise of fulfillment. If implemented, it will be noted in the Release Notes page of the Help Guide.

      Release Notes — https://ninjatrader.com/support/help...ease_notes.htm

      Please let us know if we may be of further assistance to you.

      Comment


        #18
        Thank you again for your reply.

        Probably I'm requesting incorrectly what I need.
        I will try to make me understand.

        I want the button to toggle the property "Visible" of the indicator shown in the "Indicators", "Properties" window. Please see the picture below.

        So, What I want is when I make click on the button to toggle this property, the button then toggle this property and apply it without the need to press the "F5" key every time.

        With the existing configuration, the button can toggle this property in the indicator "TrendLines", but I have to press the "F5" key after making a click on the button to take effect.

        Thank you for your patience and your help!

        Click image for larger version  Name:	Toggle this property.png Views:	0 Size:	35.1 KB ID:	1191155
        Last edited by joselube001; 02-22-2022, 05:41 PM.

        Comment


          #19
          Hello joselube001,

          Thank you for your reply.

          I understand exactly what you mean, and it is not possible to remove the drawing tool the Trend Lines indicator draws by toggling the IsVisible property of the indicator. Once an indicator draws a drawing tool, it will remain there even if the IsVisible property of the indicator itself is changed. As I said, I have added a vote for you to a feature request for this to be possible when toggling the IsVisible property of the indicator that drew a drawing tool.

          You can try to find the line drawn by the indicator by looping through the drawing tools, check whether the tag implies the tool was drawn by the Trend Lines indicator by checking whether its tag includes "Trend line", and then toggle the IsVisible property of the drawn line, but if other lines are also tagged "Trend line" it would find those as well.

          Please let us know if we may be of further assistance to you.

          Comment


            #20
            Hello Kate,

            Thank you for your answer.

            I found a way to do this, maybe isn't the best method but is working for me.

            If you have a better method to make refresh the chart that "System.Windows.Forms.SendKeys.SendWait("{F5}" );" on the needs of this specific situation, your suggestion is welcome.

            Do you know what method is used in the indicator properties window when the button "Apply" is clicked?
            Maybe that can work here too!

            I was trying with the next lines but it doesn't take effect:

            Code:
            chartWindow.ActiveChartControl.InvalidateVisual();
            ForceRefresh();
            I share the code below if someone has this same need with this or any other indicator based on drawings:

            Code:
            private void btnTrendLinesClick(object sender, RoutedEventArgs e)
            {
            System.Windows.Controls.Button button = sender as System.Windows.Controls.Button;
            if (button != null)
            {
            //Toggle TrendLines indicator
            foreach (var obj in chartWindow.ActiveChartControl.ChartObjects)
            {
            var indi = obj as TrendLines;
            if (indi != null)
            {
            if (indi.IsVisible == true)
            {
            indi.IsVisible = false;
            //Print(indi.IsVisible + " " + indi.Name + " is hidden.");
            }
            else if (indi.IsVisible == false)
            {
            indi.IsVisible = true;
            //Print(indi.IsVisible + " " + indi.Name + " is visible.");
            }
            }
            }
            System.Windows.Forms.SendKeys.SendWait("{F5}");
            }
            }

            Comment


              #21
              Hello joselube001,

              Thank you for your reply.

              The method used by the apply button in the Indicators tab would be internal to NinjaTrader and would not be accessible in a supported manner. I'm not aware of a unsupported way to replicate that.

              Looks like you've found a pretty simple workaround. I would not have a simpler suggestion.

              Please let us know if we may be of further assistance to you.

              Comment


                #22
                Good day Kate, this is really a great indicator that save time to hides objects through use of buttons in toolbar . can you help me and toggle SMA and Bollinger band. This is really a great feature to add in your future releases, instead of going into each indicator tick and untick visible option in each indicators.

                Comment


                  #23
                  Hello mkaraa,

                  Thank you for your reply.

                  In the support department at NinjaTrader we do not create, debug, or modify code for our clients. This is so that we can maintain a high level of service for all of our clients as well as our vendors. The samples we provide are intended to give you further direction to move forward, and are not intended to be used for copy and paste purposes.

                  If you are interested in services in having code written for you, I can have a representative of our EcoSystem reach out with more information on NinjaScript consultants who will be happy to do so.

                  Please let us know if we may be of further assistance to you.

                  Comment


                    #24
                    Sure let your consultant contact me , although, I thought you would help.

                    Comment


                      #25
                      Hello,

                      Thank you for your post.

                      You can search our list of NinjaScript consultants through the link below. Simply enter a consultant name or search by using our filter categories. Once you have identified your consultants of choice, please visit each consultant's site for more information or contact them directly to learn more:
                      You can locate the contact information for the consultants on their direct websites for any additional questions you may have. Since these consultants are third-party services for NinjaTrader, all pricing and support information will need to be obtained through the consultant.

                      The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The companies and services listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem, LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

                      Let me know if I may be of further assistance.
                      Thomas C.NinjaTrader Customer Service

                      Comment


                        #26
                        Originally posted by mkaraa View Post
                        Sure let your consultant contact me , although, I thought you would help.
                        Get used to it NT customer/platform does not do much besides blame 3rd party vendors and claim they are going to add, or update things, yet for the most part NT8 remains the same as it ever was. Katie LITERALLY wrote an entire script for 5 EMAs but cannot simply explain how to modify the code from EMA to SMA - if doing that isnt customer service, I dont really know what is.

                        Comment


                          #27
                          Hello, has someone written what mKara was asking for? Would someone be willing to take Kate's EMA toggle indicator and modify to be able to toggle indicators of choice? (ie. vwap, ema, etc)

                          Comment


                            #28
                            Hello Mcell89,

                            Welcome to the NinjaTrader forums!

                            I'm not aware this as an existing indicator. This thread will remain open for any community members that may know of one or would like to create this as a convenience to you.

                            As far as indicator of choice, I think it would be necessary to pre-code the list of available indicators. While it might be possible to dynamically get a list of installed indicators and populate a drop-down (or make some other controls to enable/disable this), I'm not certain it would be possible to call that indicator unless the logic to call that indicator was hard-coded. If there is a way, that would be outside of what the NinjaScript Engineering Support Team can assist with.

                            Below is a link to the reference sample showing how to pre-code a list of indicators and use this for custom logic. This example is with an enum, but you could have logic that makes menu items or buttons etc in the WPF. The point is that it is showing how the logic to call the indicators is hard-coded.
                            https://ninjatrader.com/support/help...ned_parame.htm

                            This example has some updated code on hiding/showing plots.
                            https://ninjatrader.com/support/foru...48#post1225348

                            This reference sample shows modifying the WPF.
                            https://ninjatrader.com/support/help...ui)-modifi.htm


                            You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like a list of affiliate consultants who would be happy to create this script or any others at your request or provide one on one educational services.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #29
                              i add that indicator to one my templates and when i duplicate the tab it also duplicate the indicator on the screen o every single window that is open, this is really annoying, is there a way to fix ? does anyone know how to get in touch with the developer to ask ?

                              Comment


                                #30
                                Hello eddiekellertri,

                                You are referring to the SampleUniversalMovingAverage reference sample from the help guide?
                                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
                                576 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