Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ToolBar Button for Indicator Show/Hide

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

    ToolBar Button for Indicator Show/Hide

    Dear Support,

    Is there a sample universal toolbar button indicator that can be customized to turn on/off (Show/Hide) another certain indicator of user choice.

    Thanks.


    #2
    Hello aligator,

    Thank you for your post.

    There is an indicator that will do this that is publicly available on our NinjaTrader Ecosystem website:Here is a basic guideline of how to import NinjaScript add-ons in NinjaTrader 8:

    Note — To import NinjaScripts you will need the original .zip file.

    To Import:
    1. Download the NinjaScripts to your desktop, keep them in the compressed .zip file.
    2. From the Control Center window select the menu Tools > Import > NinjaScript Add-on...
    3. Select the downloaded .zip file
    4. NinjaTrader will then confirm if the import has been successful.

    Critical - Specifically for some NinjaScripts, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'

    Once installed, you may add the indicator to a chart by:
    • Right click your chart > Indicators... > Select the Indicator from the 'Available' list on the left > Add > OK
    Please let me know if I can be of further assistance.

    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 add-ons 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.

    Comment


      #3
      Originally posted by NinjaTrader_Kate View Post
      Hello aligator,

      Thank you for your post.

      There is an indicator that will do this that is publicly available on our NinjaTrader Ecosystem website:Here is a basic guideline of how to import NinjaScript add-ons in NinjaTrader 8:

      Note — To import NinjaScripts you will need the original .zip file.

      To Import:
      1. Download the NinjaScripts to your desktop, keep them in the compressed .zip file.
      2. From the Control Center window select the menu Tools > Import > NinjaScript Add-on...
      3. Select the downloaded .zip file
      4. NinjaTrader will then confirm if the import has been successful.

      Critical - Specifically for some NinjaScripts, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'

      Once installed, you may add the indicator to a chart by:
      • Right click your chart > Indicators... > Select the Indicator from the 'Available' list on the left > Add > OK
      Please let me know if I can be of further assistance.

      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 add-ons 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.
      Thank you Kate,

      I am aware of the this indicator. This toolbar button will show/hid all indicators on a chart. Basically, I am looking for a toolbar button that will show/hide only one indicator of choice. For example, a button that can be specifically customized for RSI, MACD, etc.

      Comment


        #4
        Hello aligator,

        Thank you for your reply.

        The linked indicator actually contains code that could be easily modified to do exactly what you are looking for. Here's an example:

        Code:
                private void btnIndicatorsClick(object sender, RoutedEventArgs e)
                {
                    System.Windows.Controls.Button button = sender as System.Windows.Controls.Button;
                    if (button != null)
                    {                                
                        // toggle all indicators
                        foreach (var obj in chartWindow.ActiveChartControl.ChartObjects)
                        {
                            var indi = obj as Indicator;
                            if (indi != null)
                            {
                                if (indiSwitch)
                                {
                                    if (indi.Name !="ABMar****penLine")
                                    {
                                        indi.IsVisible = false;
                                    }
                                }
                                else if (!indiSwitch)
                                {
                                    if (indi.Name !="ABMar****penLine")
                                    {
                                        indi.IsVisible = true;
                                    }
                                }
                            }
                        }                
                        indiSwitch = !indiSwitch;
                        chartWindow.ActiveChartControl.InvalidateVisual();
                        ForceRefresh();
                    }
                }
        In this particular case, one indicator is excluded from being hidden - you could modify this easily to only include a certain indicator.

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

        Comment


          #5
          Hi Kate, I think that the indicator you are referring to will work but when I attempt to download it from EcoSystem, I get the green spinning circle in the middle of the page and that is all that happens no matter how long I give it. Would it be possible to add the zip folder as an attachment perhaps? Thanks

          Comment


            #6
            Hello khellian,

            Thank you for your reply.

            We are gathering some information for our IT team regarding users who are unable to download from the User App Share. I'll be happy to post the file for you once you answer the following questions.

            Please answer all of the following questions:
            • What version of Windows are you using?
            • What web browser are you using?
            • Does this symptom persist if your clear your browser's cache?
            • What about if you use a different web browser?
            • What about after you turn off your PC, turn off your modem/router for at least 30 seconds, then restart your PC?

            Thanks in advance; I look forward to assisting you further.

            Comment


              #7
              Kate,
              I edited the code to exclude the "VolumeUpDown" indicator, but haven't found a name that works for the VolumeUpDown indicator. These names have not excluded hiding the indicator:
              "VolumeUpdDown"
              "NinjaTrader.Custom.Resource.NinjaScriptIndica torN ameVolumeUpDown"
              "NinjaScriptIndicatorNameVolumeUpDown"
              Last edited by BruceK; 07-05-2021, 06:57 AM.

              Comment


                #8
                Hello BruceK,

                Thank you for your post.

                This doesn't seem to be in relation to this thread - I'm uncertain what you're referring to here. Was there a different post you meant to put this on?

                Thanks in advance; I look forward to assisting you further.

                Comment


                  #9
                  Dear support team, I wish 5 toggle buttons on toolbar for 5 EMAs 10, 20, 50, 100 and 200 as I don't want all plotted on the chart but I want to switch on only those which I require or else I would switch it off through toggle button.

                  Thank you

                  Comment


                    #10
                    Hello santoshv,

                    Thank you for your note.

                    It would certainly be possible to create an indicator that places buttons on the chart and allows you to toggle between several EMAs being visible. Though we generally don't do this, I've created an indicator that adds 5 different EMAs (you can choose to change the EMA periods if you wish, but it defaults to your requested EMA periods) and also adds buttons to the upper right corner of the chart that may be clicked to toggle the EMAs on or off. Each button's "On" color corresponds to the color of its plot, which can also be adjusted.

                    As I mentioned, we don't ordinarily do this, but I took it on as a learning exercise, so please find it attached.

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

                    Comment


                      #11
                      Thanks a lot for a quick and positive reply. You, Ninjatrader Support Team, are awesome. Actually I am looking for https://prnt.sc/1hfgg81 for NT8
                      Last edited by santoshv2k; 07-28-2021, 10:42 PM.

                      Comment


                        #12
                        Hi Kate,

                        The code you shared in answer #4 is useful for indicator than is based on Plots but is not working correctly with indicator than is based on drawings, because I have to press F5 after pressing a single click on the button to hide it and I have to press F5 after pressing double click to show it again, but if I press only one click to show it or hide it the indicator does not appear/disappear.

                        Can you help me to fix this issue, please?

                        Thank you very much!

                        Comment


                          #13
                          Hello joselube001,

                          Thank you for your reply.

                          If you can share some example code of what you're trying that isn't working for you, that would be helpful. If you can supply the entire current indicator, that would be best.

                          Thanks in advance; I look forward to assisting you further.

                          Comment


                            #14
                            Hi Kate,
                            Yes, of course!
                            This is based on the indicator found in NinjaTrader Ecosystem website:

                            I just added 2 buttons to toggle the "EMA" indicator and the "TrendLines" indicator.
                            With "EMA" indicator is working well, but with "TrendLines" indicator isn't working, both have the same parameters, just the reference to the indicator has been changed.

                            "EMA" is based on "Plots" and "TrendLines" is based on "Drawings".

                            You will need to add at least one "EMA" indicator and one indicator "TrendLines" to the chart, to take effect on the button to toggle.

                            This is the link to the original indicator, and as an attachment, there is the indicator modified.
                            https://ninjatraderecosystem.com/use...ers-and-wicks/

                            Thank you very much in advance!
                            Attached Files
                            Last edited by joselube001; 02-21-2022, 04:53 PM.

                            Comment


                              #15
                              Hello joselube001,

                              Thank you for your note.

                              First, you're using drawSwitch to determine whether the drawing objects should be on or off, but you're also checking only for user drawn objects. The Trend Lines indicator's drawing objects wouldn't be considered user drawn since they're being drawn by an indicator, so it simply doesn't find those objects. You're also not leaving the drawSwitch set to the opposite of what it was when you clicked the toggle button.

                              Here's my suggestion:

                              Code:
                              // in State.SetDefaults
                              drawSwitch = true;
                              
                              private void hideDrawsFunc()
                              {
                              foreach (var obj in chartWindow.ActiveChartControl.ChartObjects)
                              {
                              var draw = obj as DrawingTool;
                              if (draw != null)
                              {
                              if (drawSwitch)
                              {
                              draw.IsVisible = false;
                              drawSwitch = false;
                              //Print(draw.Name + " '" + draw.Tag + "' is hidden.");
                              }
                              else if (!drawSwitch)
                              {
                              draw.IsVisible = true;
                              drawSwitch = true;
                              //Print(draw.Name + " '" + draw.Tag + "' is visible.");
                              }
                              }
                              }
                              
                              chartWindow.ActiveChartControl.InvalidateVisual();
                              ForceRefresh();
                              }
                              We simply check the current state of drawSwitch when we're already looping through the objects and set them to hidden or not based on that state, and then set drawSwitch to the opposite value.

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

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              558 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              324 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
                              546 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              547 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X