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

How to Remove Indicator Label Name within NinjaScript code?

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

    How to Remove Indicator Label Name within NinjaScript code?

    Hi,
    Is there any function (code) or method that could be written directly into the NinjaScript code to remove the NinjaTrader Indicator "Label" Name (instead of manually deleting the "Label" Name from the indicator property windows) ?
    Example: So that the Label -->SMA does not show on the chart.
    Thanks, Joe

    #2
    Hello Joe,

    Yes, please see this reference sample for custom labels:
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Ray,

      THANKs FOR YOUR QUICK RESPONSE, It did provide good information but I Don't think it answers my question.

      PLEASE Re-Read the question again. I don't want ANY Labels DISPLAYED on the "CHART". I just want to see the Chart without showing any Indicator Names or Parameter Descriptions on the Chart itself. I do not care about the Indicator description within the Indicator Parameter Settings Window, I just care about not seeing it on the chart. To Not see an Indicator's Name and it's parameters in NT7 you have to Manually Erase/Delete it from within the in Indicators Parameters Settings Window under "Label -->SMA" (Delete the Name SMA from the Label line). HOW can I do this within the code so I don't have to Manually delete every Indicator Label Name I use and on every chart I use it on. THANKS Again VERY MUCH !!!

      Comment


        #4
        Try this:

        Code:
         
        public override string ToString()
        {
        return "";
        }
        Last edited by NinjaTrader_RyanM1; 08-10-2010, 02:46 PM.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          THANKS RAY !!!

          That WORKS.

          Now is there a way to do BOTH.

          Trim or Choose the Indicator's Desription Parameters within the Indicators Parameter Settings Window and also NOT display the Indicators Label Name on the CHART ?
          (The way it is now below, it seems to be pick one or the other, can't do both) How do we fix that ?

          public
          overridestring ToString()//No Indicator Label on Chart
          {
          Name =
          "";
          return Name;
          }

          publicoverridestring ToString()//Changed Desciption in Indicator Settings Window

          {
          return Name + "(" + Period + "," + Plots[0].Pen.Color + "," + Plots[0].Pen.Width + "," + (enableAlert ? "Alerts ON" : "Alerts OFF") + ")" ;

          THANKS AGAIN, LOOK FORWARD TO YOUR SOLUTION.

          Comment


            #6
            Unfortunately there's no way to do both.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Hi Ryan,

              Thanks for your support. For some reason your previous solution for removing the Label Name from the Chart has changed on the Forum, so I have Re-Attached it again:

              publicoverridestring ToString()
              {
              Name =
              "";
              return Name;
              }

              Comment


                #8
                HI,
                I tried adding the
                public override string ToString()
                to my strategy in NT 65. I only wish to see a few of the parameters.
                It is placed right after the variables.


                when on the chart it only displays the initialized values ( not the updated ones from the parameters form)
                Does this only work in indicators or have i placed the code in the incorrect section.

                Thank you for your patience.

                Sammy

                Comment


                  #9
                  Sammy, it should work for strategies to, please try placing it directly after the OnBarUpdate() for example -

                  Code:
                   
                  protected override void OnBarUpdate()
                  {
                  }
                   
                  public override string ToString()
                  {
                  return Name + "";
                  }
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    Hello, yeah its works but now my indicator does not plot anything in the chart. Help please . I am using a drawtext and set my string name to a variable which is integer and convert to string. Like below

                    DrawText(bgcounter.ToString(),true,"BG",0, Low[0] - (TickSize*Distance),0,BGColor, new Font("Wide Latin",Size), StringAlignment.Center, Color.Transparent, Color.Transparent, 0);

                    Comment


                      #11
                      Do you get any errors shown in your log tab? Is the condition to draw hitting at all in your example?
                      BertrandNinjaTrader Customer Service

                      Comment


                        #12
                        There is no error in terms of the string function in my log. Yes, I am using variable counter and convert it to string so that the already plotted text will not be deleted when there is another condition hit. What will I do for this Bertran? I need to hide the label name of the indicator. Thanks in advance.

                        Comment


                          #13
                          Sorry, I'm not sure I follow you - for not seeing any label you would need to override the ToString() as shown in my previous post - are you attempting to do this currently in your code as well? If you can please post the full indicator and we will take a look.

                          Thanks,
                          BertrandNinjaTrader Customer Service

                          Comment


                            #14
                            This seems to be eluded to in all the comments, but I had the same goal as the original poster. To solve it, I simply did this:

                            PHP Code:
                            protected override void OnStartUp()
                            {
                                 
                            Name string.Empty;

                            I did have to refresh the script (F5) a couple times to make it actually work. Perhaps the first time cleared the field, but it was already drawn on the chart, so the second refresh actually showed it gone.

                            Daniel

                            Comment


                              #15
                              Originally posted by neoikon View Post
                              This seems to be eluded to in all the comments, but I had the same goal as the original poster. To solve it, I simply did this:

                              PHP Code:
                              protected override void OnStartUp()
                              {
                                   
                              Name string.Empty;

                              I did have to refresh the script (F5) a couple times to make it actually work. Perhaps the first time cleared the field, but it was already drawn on the chart, so the second refresh actually showed it gone.

                              Daniel

                              NT_JoyDeep has a chartcontrol command to sendkey to f5.. so you could issue that command within your code.

                              i tried searching on "sendkey" and "f5" and "sendkey f5" and failed.


                              Hopefully someone has it bookmarked.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by helpwanted, Today, 03:06 AM
                              1 response
                              10 views
                              0 likes
                              Last Post sarafuenonly123  
                              Started by Brevo, Today, 01:45 AM
                              0 responses
                              9 views
                              0 likes
                              Last Post Brevo
                              by Brevo
                               
                              Started by aussugardefender, Today, 01:07 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post aussugardefender  
                              Started by pvincent, 06-23-2022, 12:53 PM
                              14 responses
                              242 views
                              0 likes
                              Last Post Nyman
                              by Nyman
                               
                              Started by TraderG23, 12-08-2023, 07:56 AM
                              9 responses
                              387 views
                              1 like
                              Last Post Gavini
                              by Gavini
                               
                              Working...
                              X