Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

New Indicator Wizard generated code comments

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

    New Indicator Wizard generated code comments

    Presumably the generated code is intended to show best practices for the things it generates. Some things immediately catch my attention:
    • The GUI property is dynamically initialized in State.SetDefaults. For a variety of reasons it would be better to initialize properties at compile time so far as possible. It is rare that a property needs dynamic initialization.
    • The wizard provides no place to specify the GUI-friendly name for a property. It enforces a C# identifier syntax on the name, which is not what you want to see in the GUI.

    I also see that the DefaultValue attribute does not work. In NT7 best practices was to set the DefaultValue attribute for a property that was going to show up in the GUI. Doing so allowed the GUI to display the default value in plain font, and any changes in bold font. That made it easy for the user to see what he had changed -- a nice touch. NT8 does not honor the DefaultValue attribute. Is there some alternative way to accomplish the same thing?

    The generated code had this line:
    [Display(Name="Length", Description="Number of bars to use when calculating this indicator", Order=1, GroupName="Parameters")]

    What I do not see is the description showing up anywhere in the Indicators dialog. Am I missing something?

    Another thing in the generated code that is not best practices: the property access to the plots in the Values[] array is a hard-coded offset. That is fragile. I added 3 lines and 2 plots in the wizard, in that order, so the hard-coded offsets are Values[3] and Values[4]. Those will be wrong if I add another line, or decide to remove a line. The code and the property are far enough away that the need to make a matching change is not obvious. It would be a lot less fragile if the code had some symbolic way to track the proper offset into the Values[] array.

    --EV
    Last edited by ETFVoyageur; 08-01-2015, 11:19 AM.

    #2
    Description -- I found my answer. NT8 no longer shows it in the dialog; it is shown only as a tooltip.

    That's fine for a short description; I wonder how it will work for a long-ish multi-line description.

    --EV

    Comment


      #3
      Hi ETFVoyageur,

      Thanks for your report. Should you run into any oddities with multi-line descriptions on the tooltip displays, please let us know.
      <span class="name">Alex C.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

      Comment


        #4
        Originally posted by NinjaTrader_AlexC View Post
        Hi ETFVoyageur,

        Thanks for your report. Should you run into any oddities with multi-line descriptions on the tooltip displays, please let us know.
        Multi-line tooltips seem to work fine.

        Is there a way to get NT7-like default value behavior in NT8?

        --EV
        Last edited by ETFVoyageur; 08-03-2015, 02:19 PM.

        Comment


          #5
          Hi ETFVoyageur,

          There is not a way to accomplish this currently.
          <span class="name">Alex C.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

          Comment


            #6
            Originally posted by ETFVoyageur View Post
            ...
            Is there a way to get NT7-like default value behavior in NT8?

            --EV
            Another WinForms nicety that was lost in the transition to WPF. Then again, it was broken in NT7.

            ref: http://ninjatrader.com/support/forum...t=defaultvalue

            Comment


              #7
              Originally posted by NinjaTrader_AlexC View Post
              Hi ETFVoyageur,

              There is not a way to accomplish this currently.
              That's too bad ... it is a really nice usability point for the user to be able to see what he has changed. Of course, unlike NT7, the system-supplied property grid entries should also provide default value information. But even without that, default values should be supported for the indicator.

              Please put in a request to implement sane default value behavior. I noted the NT comment from the link Mr. K. has provided saying
              if this is a use case you wish to fulfill to satisfy a client's request, we will make it so in NT8
              It is a usability issue, so I certainly hope you can make it so.

              --EV

              Comment


                #8
                Originally posted by ETFVoyageur View Post
                That's too bad ... it is a really nice usability point for the user to be able to see what he has changed. Of course, unlike NT7, the system-supplied property grid entries should also provide default value information. But even without that, default values should be supported for the indicator.

                Please put in a request to implement sane default value behavior. I noted the NT comment from the link Mr. K. has provided saying
                It is a usability issue, so I certainly hope you can make it so.

                --EV
                It was a use case for a client, for exactly the reason that we both said: to tell if things were off default. I could not satisfy the client's request, so I lost the client.

                I was not too worried about it because there was no other coder who could have satisfied the request, as the problem was finally admitted to by NT that it was an NT problem.

                My only beef was that had it been admitted earlier, instead of the runaround with red herrings that I got, I might have been able to explore other possibilities with the client, or at least been able to get him to understand why what he wanted could not be done. But no matter: we win some, we lose some.

                Comment


                  #9
                  NT has been making a point of saying that NT8 is intended to be a great development platform. One of the things a great development platform must do is enable developers using it to create a great GUI, including great usability, for their products. Not all developers will do that, of course, but those that believe they will be rewarded for doing so should be able to. Developers doing so are doing good, both for themselves and for NT. That's why I have pointed some things I see as issues in this area.

                  I'm sorry to hear that Mr. K. lost a customer over this point, but it does illustrate why developers need to be able to create a great GUI for their customers. What is needed for a full solution to this issue is:
                  • Indicators can specify the default value for their properties (the default value attribute would be fine with me)
                  • The system will provide default value indication for the things it adds
                  • The GUI will visually indicate things that are not at their default value. Bolding is fine for text and for check boxes. Another solution is needed for colors.
                  • It would be nice if the GUI provided a "return all properties to default values" control. This needs to be optional for the indicator because many indicators are too simple to need or want it.
                  • It would be nice if the context (right mouse) menu for each property included an entry to reset just that property to its default value.
                  • Reset capability should be provided by NT as a standard part of the GUI because (a) then it will be the same for all indicators and (b) it is common boilerplate code all indicators can use, so NT should just do it.

                  But do not let the perfect become the enemy of the good. A good beginning would be to honor the default value attributes set by the indicator on its properties.

                  =====

                  On a related note -- is there an answer to my question about how to control grid category ordering in NT8? NT7 used leading tabs, which was fine by me, but which has a problem in NT8 -- NT8 prints the leading tabs, while NT7 did not. Please tell me there is a sane way to control category ordering in NT8.

                  --EV
                  Last edited by ETFVoyageur; 08-03-2015, 10:51 PM.

                  Comment


                    #10
                    Adding support for the DefaultValue is on radar, but as this behavior was brought to our attention late in the development in NinjaTrader 8, did not make the cut in time for beta. We're focused in on bug reports at this time, but as we start moving into production, we will go back to reimplementing features based on client demand. I've counted your votes for Support for DefaultValue Attribute and is tracked using ID #SFT-569


                    Originally posted by ETFVoyageur View Post

                    On a related note -- is there an answer to my question about how to control grid category ordering in NT8? NT7 used leading tabs, which was fine by me, but which has a problem in NT8 -- NT8 prints the leading tabs, while NT7 did not. Please tell me there is a sane way to control category ordering in NT8.

                    --EV
                    There is a NinjaTrader.Gui.CategoryOrder() attribute you can add to the indicator class

                    Code:
                    [Gui.CategoryOrder("Strings", 0)]
                    [Gui.CategoryOrder("Bools", 10)]
                    [Gui.CategoryOrder("Ints", 20)]
                    public class MyCustomIndicator : Indicator
                    {
                    	#region Properties	
                    	[Display(GroupName="Ints")]
                    	public int int_A
                    	{ get; set; }
                    	
                    	[Display(GroupName="Ints")]
                    	public int int_B
                    	{ get; set; }
                    
                    	[Display(GroupName="Ints")]
                    	public int int_C
                    	{ get; set; }
                    	
                    	[Display(GroupName="Bools")]
                    	public bool bool_A
                    	{ get; set; }
                    
                    	[Display(GroupName="Bools")]
                    	public bool bool_B
                    	{ get; set; }
                    	
                    	[Display(GroupName="Bools")]
                    	public bool bool_C
                    	{ get; set; }
                    
                    	[Display(GroupName="Strings")]
                    	public string string_A
                    	{ get; set; }
                    
                    	[NinjaScriptProperty]
                    	[Display(GroupName="Strings")]
                    	public string string_B
                    	{ get; set; }
                    
                    	[NinjaScriptProperty]
                    	[Display(GroupName="Strings")]
                    	public string string_C
                    	{ get; set; }
                            #endregion
                    }
                    MatthewNinjaTrader Product Management

                    Comment


                      #11
                      Originally posted by NinjaTrader_Matthew View Post
                      Adding support for the DefaultValue is on radar, but as this behavior was brought to our attention late in the development in NinjaTrader 8, did not make the cut in time for beta. We're focused in on bug reports at this time, but as we start moving into production, we will go back to reimplementing features based on client demand. I've counted your votes for Support for DefaultValue Attribute and is tracked using ID #SFT-569




                      There is a NinjaTrader.Gui.CategoryOrder() attribute you can add to the indicator class

                      Code:
                      [Gui.CategoryOrder("Strings", 0)]
                      [Gui.CategoryOrder("Bools", 10)]
                      [Gui.CategoryOrder("Ints", 20)]
                      public class MyCustomIndicator : Indicator
                      {
                      	#region Properties	
                      	[Display(GroupName="Ints")]
                      	public int int_A
                      	{ get; set; }
                      	
                      	[Display(GroupName="Ints")]
                      	public int int_B
                      	{ get; set; }
                      
                      	[Display(GroupName="Ints")]
                      	public int int_C
                      	{ get; set; }
                      	
                      	[Display(GroupName="Bools")]
                      	public bool bool_A
                      	{ get; set; }
                      
                      	[Display(GroupName="Bools")]
                      	public bool bool_B
                      	{ get; set; }
                      	
                      	[Display(GroupName="Bools")]
                      	public bool bool_C
                      	{ get; set; }
                      
                      	[Display(GroupName="Strings")]
                      	public string string_A
                      	{ get; set; }
                      
                      	[NinjaScriptProperty]
                      	[Display(GroupName="Strings")]
                      	public string string_B
                      	{ get; set; }
                      
                      	[NinjaScriptProperty]
                      	[Display(GroupName="Strings")]
                      	public string string_C
                      	{ get; set; }
                              #endregion
                      }
                      Very nice. Straight to the "Important Info" category in my notes.

                      Is it by any chance in the official documentation yet?
                      Last edited by koganam; 08-04-2015, 09:30 AM.

                      Comment


                        #12
                        Pending in the next few weeks, along with the other attributes which have yet to be documented.
                        MatthewNinjaTrader Product Management

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by oviejo, Today, 12:28 AM
                        1 response
                        11 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Started by geddyisodin, Yesterday, 05:20 AM
                        7 responses
                        46 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Started by gbourque, Today, 06:39 AM
                        2 responses
                        5 views
                        0 likes
                        Last Post gbourque  
                        Started by cre8able, Yesterday, 07:24 PM
                        1 response
                        13 views
                        0 likes
                        Last Post NinjaTrader_ChelseaB  
                        Started by cocoescala, 10-12-2018, 11:02 PM
                        7 responses
                        939 views
                        0 likes
                        Last Post Jquiroz1975  
                        Working...
                        X