Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Hiding Label

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

    Hiding Label

    I keep all my indicator labels hidden so that they don't clutter the screen.
    I downloaded an indicator from the NT User App Share Forum, Opening Price (R1).
    For each day, it draws a horizontal line at a user-determined time which is set in the indicator.
    It works great, but it takes the title used in the indicator listing from the label plus the time, e.g., if the label is blank and the time is set to 8, the indicator listing becomes "(8)". If I name the label "Open", the title in the indicator list becomes "Open (8)".
    I have quite a few indicators. I keep them organized by placing them in alphabetical order.
    I'm not knowledgeable enough to revise the code, but I'm hoping that it's simple enough to change so that you can supply me with the necessary text. I'm fine if I have to hard code the indicator title into the script, e.g., "Opening Time" without the actual time and can't change it for each instance.

    Here's how what I think is the appropriate code section currently reads:

    // In order to trim the indicator's label we need to override the ToString() method.
    public override string DisplayName
    {
    get { return Name + "(" + OpenHour + ")";}
    }

    Any help you could give me would be appreciated.

    Thanks,
    Stephen

    #2
    Hello Stephen,

    Thank you for your post.

    You are correct that the portion of code regarding DisplayName is what is changing the label. For more information about DisplayName, see the help guide page here:


    If you want this script's display name and label to behave like your other indicators, you could remove this override from the script and then recompile (F5 keyboard shortcut). This will have the script revert back to the default label, which would be the name "OpeningPrice" along with the input and data series parameters. If you change the label to be blank in the indicator settings (as you do with your other indicators) then the OpenHour will not be filled in anymore.

    Here are the steps to make this change:
    • Go to Control Center > New > NinjaScript Editor
    • Expand Indicators and double-click on the Opening Price indicator to open the script
    • Delete these lines from the script:
      • Code:
        // In order to trim the indicator's label we need to override the ToString() method.
        		public override string DisplayName
        		{
        		get { return Name + "(" + OpenHour + ")";}
        		}​
    • Press F5 on your keyboard to compile and save the changes
    • Now, remove then re-add the indicator to your charts and notice the Label will follow the default behavior
    Please let us know if we may be of further assistance.

    Comment


      #3
      Emily, I wanted to thank you for providing me with the code changes I needed and doing it so explicitly that a non-coder could understand it. It went beyond the call of duty, and it worked perfectly.

      Best,
      Stephen

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      20 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      119 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      63 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      41 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      45 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X