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

Hide Labels

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

    Hide Labels

    Hi,

    I have a strategy that displays a few indicators and I would like to hide the labels that are displayed on a chart. I normally just blank these out for indicators on a normal chart.

    Is there a way to do this with indicators that are displayed as part of a strategy?

    Thanks

    Ian

    #2
    Hello IanC28,

    At this time, there is not a way to control this from the strategy its self however you can control this from the individual indicators in their code.

    We have a sample that explains the indicators label and how to format/remove it in the following link: https://ninjatrader.com/support/help...lightsub=label

    if you use custom formatting in code, you can remove the label or reduce its length/make it more readable if needed.

    Keep in mind if you remove the label completely in code using the DisplayName override, that can change how the item is listed in the platforms user interface. Generally, you should also use the State object to provide a default label. You can find an example here: http://ninjatrader.com/support/forum...6&postcount=24

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

    Comment


      #3
      Jesse,

      Thanks for that. Much appreciated.

      Ian

      Comment


        #4
        Actually there is a way to do this. I have my chart nice and clean with only my strategy name.

        This is what you do..

        PHP Code:
        //This takes care of your strategy name

        private string     strategyName;
        strategyName = (GetType().Name).ToUpper(); // I like to have it in uppercase

                
        public override string DisplayName
                
        {
                  
        get { return strategyName; }
                }

        //------------------------------------------------------------

        Now I create an method that is called from
                    
        else if (State == State.DataLoaded)
                    {
                        
        zClearIndicatorLables();  
                    }

        public 
        void zClearIndicatorLables()
                {
                    if(
        ChartControl == null) return;

                    foreach( var 
        i in ChartControl.Indicators)
                    {        
                        if(
        i.IsOverlay)
                        {
                        
        i.Name"";
                        }
                    }
                }
        //------------------------------------------------------------ 
        This clears out the label of each indicator that is attached to the chart that is in panel 1 (main chart). The only problem is that if you want the label back, you need to remove the indicator and re-add it to the chart.
        Last edited by cutzpr; 02-07-2019, 07:48 PM.

        Comment


          #5
          Hi Cutzpr,

          Thanks for that.

          It works well for indicators added to the chart.

          Do you know if this can be modified for indicators added by the strategy?

          Thanks

          Ian

          Comment


            #6
            Originally posted by IanC28 View Post
            Hi Cutzpr,

            Thanks for that.

            It works well for indicators added to the chart.

            Do you know if this can be modified for indicators added by the strategy?

            Thanks

            Ian
            This should work for all indicators that are attached to the same chart as the strategy. I have this code loaded in my strategies, not my indicators.

            Comment


              #7
              Hi Cutzpr,

              I added code to list the indicators being processed, and it appears that only the indicators that are loaded directly onto the chart are listed. The indicators added by the strategy are not included.

              I tried changing the declaration of the indicator in the strategy from private to public, but that doesn't affect the result.

              Thanks

              Ian

              Comment


                #8
                Just remove the

                PHP Code:

                if(i.IsOverlay)
                {

                This is filtering the command to only indicators that are loaded to the chart.

                Change to
                PHP Code:
                       foreach( var i in ChartControl.Indicators)
                                {        
                                    
                i.Name"";
                                } 

                Comment


                  #9
                  Originally posted by cutzpr View Post
                  Actually there is a way to do this. I have my chart nice and clean with only my strategy name.

                  This is what you do..

                  PHP Code:
                  //This takes care of your strategy name

                  private string strategyName;
                  strategyName = (GetType().Name).ToUpper(); // I like to have it in uppercase

                  public override string DisplayName
                  {
                  get { return strategyName; }
                  }

                  //------------------------------------------------------------

                  Now I create an method that is called from
                  else if (State == State.DataLoaded)
                  {
                  zClearIndicatorLables();
                  }

                  public 
                  void zClearIndicatorLables()
                  {
                  if(
                  ChartControl == null) return;

                  foreach( var 
                  i in ChartControl.Indicators)
                  {
                  if(
                  i.IsOverlay)
                  {
                  i.Name"";
                  }
                  }
                  }
                  //------------------------------------------------------------ 
                  This clears out the label of each indicator that is attached to the chart that is in panel 1 (main chart). The only problem is that if you want the label back, you need to remove the indicator and re-add it to the chart.
                  Do this work removing the labels from the Data Series? I've multiples and I cannot find a way to remove the label. Any help is much appreciated.

                  Comment


                    #10
                    Hi danalec,

                    I have managed to remove all labels, but it was a bit of a fiddle using a couple of different methods depending on situation.

                    Are all your indicators placed on a chart manually, or do you use strategies to display the indicators?

                    When you say you have multiples is that multiple indicators on one chart, or multiple instruments on one chart with indicators on each instrument.

                    Thanks

                    Ian

                    Comment


                      #11
                      Originally posted by IanC28 View Post
                      Hi danalec,

                      I have managed to remove all labels, but it was a bit of a fiddle using a couple of different methods depending on situation.

                      Are all your indicators placed on a chart manually, or do you use strategies to display the indicators?

                      When you say you have multiples is that multiple indicators on one chart, or multiple instruments on one chart with indicators on each instrument.

                      Thanks

                      Ian
                      Thanks for replying.

                      Currently all my indicators can be hidden but when I add ^NQ and ^MNQ in the same chart, I cannot remove their label.

                      For some reason it displays their respective label but there are no option to hide them.

                      I was wondering if your code could give me a hint to do so.

                      Thanks again for the attention,

                      Dan

                      Comment


                        #12
                        Hi Dan,

                        I don't have data for these symbols, so can't check out.

                        The code only hides the labels of indicators.

                        Since both your symbols are effectively the same on a chart it would be impossible to differentiate between them if the label was removed.

                        Sorry I can't assist.

                        Ian

                        Comment


                          #13
                          Originally posted by IanC28 View Post
                          Hi Dan,

                          I don't have data for these symbols, so can't check out.

                          The code only hides the labels of indicators.

                          Since both your symbols are effectively the same on a chart it would be impossible to differentiate between them if the label was removed.

                          Sorry I can't assist.

                          Ian
                          It can be reproduced with any symbol, I used them as example but it might happen with any instrument.
                          I've added both symbols and it displays an annoying label and I cannot remove them.

                          Thanks anyways

                          Comment


                            #14
                            Dan,

                            Just remove the label. See the attached.

                            Ian
                            Attached Files

                            Comment


                              #15
                              Originally posted by IanC28 View Post
                              Dan,

                              Just remove the label. See the attached.

                              Ian
                              It just worked in a new chart. I guess, somehow, xml template file was corrupted.

                              Thanks very much, I wonder if more people has problem "data series preset save", it seems to work randomly.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by josh18955, 03-25-2023, 11:16 AM
                              6 responses
                              435 views
                              0 likes
                              Last Post Delerium  
                              Started by FAQtrader, Today, 03:35 PM
                              0 responses
                              3 views
                              0 likes
                              Last Post FAQtrader  
                              Started by rocketman7, Today, 09:41 AM
                              5 responses
                              18 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by frslvr, 04-11-2024, 07:26 AM
                              9 responses
                              126 views
                              1 like
                              Last Post caryc123  
                              Started by selu72, Today, 02:01 PM
                              1 response
                              14 views
                              0 likes
                              Last Post NinjaTrader_Zachary  
                              Working...
                              X