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

BUG: NAME Property behaviour changed in v7.0.1, no way to strip plot indicator names

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

    BUG: NAME Property behaviour changed in v7.0.1, no way to strip plot indicator names

    Code:
    [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]protected [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]override [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] Initialize() { [/SIZE][/FONT]
    [/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]Name = [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]" "[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]; [FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000]// <<- this is the keyword[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/SIZE][/FONT][/SIZE][/FONT]
    [FONT=Courier New][SIZE=2][SIZE=2][FONT=Courier New]}[/FONT][/SIZE][/SIZE][/FONT]
    Code:
    [SIZE=2][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2][Gui.Design.DisplayName(The following code let you set the name of the Indicator in the indicators panel.
    [/SIZE]In v6.5 the Name keyword sets the value of the Indicators => Parameters => Label value. It also allows you to set the text displayed for an indicator at the top of a Panel.
     
    [FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"TI Tick Counter"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])][/SIZE][/FONT]
    [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]public [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]class[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] TITickCounter : Indicator[/SIZE][/FONT][/SIZE][/FONT][/SIZE]
    [/FONT][/FONT][/SIZE]


    In V7.0 this behavior has changed. Now it also changes the name of the indicator as it is displayed in the Indicators Listbox.

    This extra capability is nice, But it prevents a common use case of setting the value to <Blank>. Which was a nice way to prevent cluttering the display of all the parameters, especially when sharing your screen with others.


    In the picture above: you'll note the Label <Name Text> affects the indicator name in 3 places. Setting it to blank (eg: " ") would cause the List of Indicators to appear empty thus preventing the Trader from knowing which of the blank indicators they want to choose.


    Is this new capability "By Design"? If so :-
    1. Could you please list it in the Breaking Changes document for v6.5 - v7.0 migration.
    2. Is there any way to set the Label to blank & not also trash the Actual name in the Listbox?

    #2
    I do not know about the other two, but the one you have highlighted in blue comes from ToString()

    Comment


      #3
      Hi, I don't understand your reply. So perhaps I was unclear.

      In v6.5 when you set the NAME property in the Initialize() method. It changed the value of LABEL in the properties pane. (eg the Right hand side in the diagram.)
      If you leave this value unchanged then the name of the indicator & all the values of its property values are displayed in text in the chart (eg: SMA(5) )
      If you clear it (or set it to an emppty string) then the indicator name & its parameter values are not displayed in your chart.

      In short I'm not looking to discover the indicator name nor change its value in code.
      I am saying that "the effect of setting this property has changed from v6.5 to 7.0."
      While the change is nice that we now have a way to rename our indicators in the Indicator Listbox,
      We no longer have a way to do what it did in v6.5, which was to control the display name in the chart.

      Comment


        #4
        > We no longer have a way to do what it did in v6.5, which was to control the display name in the chart

        I am assuming that you mean the text that appears at the top of the chart window, and the text that appears in the pane label for your pane in the Data Box.

        If that is what you mean, then override ToString() and you can put any text you want there.

        The only surprise is that if ToString() depends on any calculated value, you need to do that calculation in either Initialize() or ToString() itself, because ToString() will be called before you get as far as OnStartUp(). ToString() also supplies the text that goes in the list of indicators you have loaded in the bottom left pane of the Indicators dialog.

        --EV

        Comment


          #5
          David, I will have someone get back to you on Monday.
          AustinNinjaTrader Customer Service

          Comment


            #6
            Guys, can you please try setting the Name property from the Initialize() to your custom display name string? This should then show up as label when adding the indicator to your charts -

            protected override void Initialize()
            {
            Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
            Overlay = true;
            this.Name = "myCustomInd_xxx";
            }
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Let me restate the problem with pictures. Part 1/2

              Sorry, I got lazy with I posted this & didn't include sufficient pictures.

              Overview
              1. I know how to change this property in code.
              2. Changing the Name property in V7.0 has an unfortunate side efect that was not there in v6.5. As I'll attempt show below.
              My Goal - To strip the indicator display name from the chart by default.
              Background info

              If I use the code below
              Code:
              [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]protected [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]override [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] Initialize() {[/SIZE][/FONT]
              [/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]Name = [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"TI MultiMA v1.1"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2];[/SIZE][/FONT]
              [SIZE=2][FONT=Courier New]}[/FONT][/SIZE][/SIZE][/FONT]

              Its name is displayed in the chart above. Actually it is the default & I don't even need to set this property.

              If the user wants it blank they can highlight the label property & clear it.




              This creates the desired result of no Indicator name in the chart.
              FYI: In v6.5 They could also type in some other string if they want to strip the parameter display. This no longer works in v7.0, but that is a different bug.




              ( This post is continued in Part 2. I needed to split it as each post is limited to 4 pictures )

              Comment


                #8
                Let me restate the problem with pictures. Part 2/2

                ( Part 2 of Prior post, needed to split it as each post is limited to 4 pictures )

                THE ISSUE I'M REPORTING

                If I use the code below, to clear the name property by default.
                Code:
                [FONT=Courier New][FONT=Courier New][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]protected [/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]override [/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff][FONT=Courier New][COLOR=#0000ff]void[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][FONT=Courier New] Initialize() {[/FONT]
                [/FONT][FONT=Courier New][FONT=Courier New]Name = [/FONT][/FONT][FONT=Courier New][COLOR=#800000][FONT=Courier New][COLOR=#800000][FONT=Courier New][COLOR=#800000]""[/COLOR][/FONT][/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][FONT=Courier New]; [/FONT][/FONT][FONT=Courier New][COLOR=#008000][FONT=Courier New][COLOR=#008000][FONT=Courier New][COLOR=#008000]// <- Set this to an empty string[/COLOR][/FONT]
                [/COLOR][/FONT][/COLOR][/FONT][FONT=Courier New][FONT=Courier New][COLOR=#000000]}[/COLOR][/FONT][/FONT][/FONT][/FONT]
                The actual indicator name is cleared in the Selection List


                It appears at the top of the list as an empty item.


                I trust this makes more sense.

                Summary
                In short v7.0 has given me the ability to Rename my indicators in the List above. And taken away the ability to control how the text of its name is displayed on the chart. I can neither set it to blank by default. Nor can the trader modify its name so that it will display without showing any the parameter values.

                I hope this helps
                Dave
                Last edited by David Lean; 02-07-2011, 04:45 PM. Reason: improved clarity

                Comment


                  #9
                  To solve that problem, you just need to override ToString() thus:

                  Code:
                  public override string ToString() {return "NameOnChart";}

                  this.Name
                  will still rename the indicator in the selection and information panels.

                  It would appear that NameOnChart cannot be null or blank, but can be a single space, which gives the same visual effect. There have been reports that a null string causes a crash, but no one has isolated the exact circumstances in which it occurs, or if it always occurs.
                  Attached Files
                  Last edited by koganam; 02-07-2011, 07:09 PM.

                  Comment


                    #10
                    Originally posted by koganam View Post
                    To solve that problem, you just need to override ToString() thus:

                    Code:
                    public override string ToString() {return "NameOnChart";}
                    this.Name will still rename the indicator in the selection and information panels.
                    It looks to me as if the problem is that he wants to set ToString() to null, and it is used three visible places:
                    • in the list of indicators added to the chart
                    • As the indicator label in Data Box
                    • As the string displayed on the chart.

                    The OP wants the last of those three to be null, but presumably not the first and second

                    --EV

                    Comment


                      #11
                      You may have responded too quickly. I have edited the original answer to indicate that ToString() can be overridden to a single space. It seems that overriding it to a blank string causes an exception. I am not sure what overriding it to null will cause.

                      Comment


                        #12
                        My point is that it looks to me as if there are three places that are set by a call to ToString(). He only wants to blank out one of them.

                        There is one thing that could be investigated, but if it works would be TOTALLY unsupported. Are all three from the SAME call to ToString()? If they are from different calls, then ToString() could return different values each time.

                        --EV

                        Comment


                          #13
                          Kindly take a look at the graphic. It shows clearly that this.Name changes the string in 2 places, and ToString() in only the place that he wants. It would seem that if this.Name is not specified, then ToString() is the default override in all 3 places; otherwise, only in the desired spot.

                          Comment


                            #14
                            This topic interested me, since I routinely override ToString(). On investigation, it turns out that things are pretty logical, although there are a couple of special-case checks for things like the user clearing all text from the label, or ToString returning a string consisting of all spaces.

                            As near as I can see, here is the situation as it pertains to this thread:

                            1) Mr. K's suggestion works closely enough for blanking out the indicator text in the chart panel. You still get the leading comma and the blank space -- but that may be close enough. You can avoid even that visual artifact if ToString() returns an empty string -- but note Mr. K's concern that may crash NT. Worked fine for me -- is it possible that is an old bug that has been fixed?

                            2) If you do that, there is one undesirable side effect. The label for the indicator in the Data Box is also blanked out. As far as I can tell, the text at the top of the chart panel and the text that in the label for the indicator in the Data Box are joined at the hip. I found no way to make them be different.

                            3) David's original request -- to have a way to default Visual | Label to the empty string -- remains unsatisfied. I do not know any satisfactory way to do that. As he noted, you can make it blank, but that also makes its name blank in the list of available indicators.

                            Bottom line:
                            • You can blank out the text in the chart (or at least nearly so) programmatically
                            • You cannot, for all practical purposes, default the Label to blank
                            • That means that you cannot default the text on the chart to blank
                            • The user can set the Label to blank if desired, thus clearing the text on the chart. The problem with this from David's point of view is that you cannot set that to be the default behavior.


                            There are some other details along the way in the thread, but I can explain all of them if anyone cares.

                            --EV

                            Comment


                              #15
                              Your findings are correct - though I could not reproduce any crashes on my end here with the overridden empty chart label, if there's a case scenario from anybody participating in this thread, please let me know.

                              If you set the Name property in Initialize(), it will effect the listing name and label name.

                              If you override the label with the ToString(), you can blank out the chart's indicator label, but it would not apply to the Label listed under the indicator properties - I'll forward to our developers to look into if expected outcome, plots would still be seen in the DataBox though even if the label was overridden to be empty.

                              Thanks all,
                              BertrandNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by frankthearm, Today, 09:08 AM
                              5 responses
                              11 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              3 responses
                              43 views
                              0 likes
                              Last Post jeronymite  
                              Started by yertle, Today, 08:38 AM
                              5 responses
                              15 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by adeelshahzad, Today, 03:54 AM
                              3 responses
                              18 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by bill2023, Yesterday, 08:51 AM
                              6 responses
                              27 views
                              0 likes
                              Last Post NinjaTrader_Erick  
                              Working...
                              X