Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

indicator name on chart transparent

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

    indicator name on chart transparent

    is there any way to make the indicator names transparent on the chart so that they can be enabled for error tracing but not clutter up the chart pane ?
    i have to blank out the indicator name in the dialog because i can't stomach the text mess at the top of the chart but i still need the indicator name in case there's an error in the log that needs to be run down... right now the log errors don't list the indicator because the name space is blanked out for visual sanity... thanks in advance...

    #2
    Hi stafe, thanks for posting. The only way to remove the Indicator label is from the Name property or override the DisplayName property. You can put your code in try/catch blocks to write your own custom logs if an exception is thrown, that would be the only alternative option, or write the Name while debugging.

    Kind regards,
    -ChrisL

    Comment


      #3
      stafe

      If this helps.

      As an example I created a copy of the NT8 EMA indicator and added the code for what you want to chose to display or not the indicator name.

      I've attached it as "EMA No Label NT8.zip" so you can view the code for yourself.

      It's best to first make a copy of the indicator/s you want to edit the code for.
      You can always delete the original once you know you've added the code correctly.

      Open your indicator via the Control Centre:
      New > Ninja Script Editor
      Find your indicator in right pane and double click to open it.
      Once open then right click anywhere in blank area > Save As and give it a name.
      Once this newly named version is open you can apply the following code.
      Once you're satisfied and it compiles without error you can use the newly named indicator and or apply the code to the original and delete the new one. Which ever.


      It's not complicated.
      Just add three bits of code:-

      1.
      In OnStateChange I added:-
      Code:
       DisplayIndicatorName = false;
      Note: I set this to "false" so saves unticking the box..(see below)


      2.
      Just above OnBarUpdate I added:-
      Code:
       public override string DisplayName
      {
      get { if (State == State.SetDefaults)
      return Name;
      else if (DisplayIndicatorName)
      return Name;
      else return ""; }
      }


      3.
      In Properties I added:-
      Code:
      [NinjaScriptProperty]
      [Display(Name="Show Indicator Name", Description="Draw a symbol to mark change in direction", Order=1, GroupName="Setup")]
      public bool DisplayIndicatorName
      { get; set; }
      Note: you can chose the GroupName for where in the indicator dialog the tick box will appear. ie "Setup" and you can type in your own Display Name ie: "Show Indicator Name"



      The whole code:

      Code:
      public class EMANoLabel : Indicator
      {
      private double constant1;
      private double constant2;
      
      protected override void OnStateChange()
      {
      if (State == State.SetDefaults)
      {
      Description = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDe scriptionEMA;
      Name = "EMANoLabel";
      IsOverlay = true;
      IsSuspendedWhileInactive = true;
      Period = 14;
      
      [COLOR=#16a085][B]///added Display name[/B][/COLOR]
      [B]DisplayIndicatorName = false;[/B]
      
      
      AddPlot(Brushes.Goldenrod, NinjaTrader.Custom.Resource.NinjaScriptIndicatorNa meEMA);
      }
      else if (State == State.Configure)
      {
      constant1 = 2.0 / (1 + Period);
      constant2 = 1 - (2.0 / (1 + Period));
      }
      }
      
      [COLOR=#1abc9c][B]///added Display Name[/B][/COLOR]
      [B]public override string DisplayName
      {
      get { if (State == State.SetDefaults)
      return Name;
      else if (DisplayIndicatorName)
      return Name;
      else return "";
      }
      }[/B]
      
      protected override void OnBarUpdate()
      {
      Value[0] = (CurrentBar == 0 ? Input[0] : Input[0] * constant1 + constant2 * Value[1]);
      }
      
      #region Properties
      [Range(1, int.MaxValue), NinjaScriptProperty]
      [Display(ResourceType = typeof(Custom.Resource), Name = "Period", GroupName = "NinjaScriptParameters", Order = 0)]
      public int Period
      { get; set; }
      
      
      [B][COLOR=#16a085]///Display Indicator Name[/COLOR][/B]
      [B][NinjaScriptProperty]
      [Display(Name="Show Indicator Name", Description="Draw a symbol to mark change in direction", Order=1, GroupName="Setup")]
      public bool DisplayIndicatorName
      { get; set; }[/B]
      
      
      #endregion
      }

      You'll then get a box you can tick to display or untick to not display the indicator name on the chart:

      Click image for larger version  Name:	Show Indicator Name.jpg Views:	0 Size:	4.1 KB ID:	1202873

      Click image for larger version  Name:	Show Indicator Name-ticked.jpg Views:	0 Size:	3.9 KB ID:	1202875

      Hope that helps
      Last edited by dj22522; 06-20-2023, 07:52 AM.

      Comment


        #4
        Hi dj22522,

        Thank you very much for take your time and share this useful code and all the details!!!

        This is very useful for some of us like me.

        I really appreciate this content!!!

        Comment


          #5
          @dj22522 !!!! wow, don't know what to say... thank you so much... this will really help me out immeasurably as i'm always running into some new issue with stuff i've written... still a newbie after so many years at C#...

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          639 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          366 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          107 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          569 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          572 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X