Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding non GridCategory property to PropertyGrid in Strategies

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

    Adding non GridCategory property to PropertyGrid in Strategies

    With Indicators I can add properties to PropertyGrid using various Categories that are not used as Parameters (eg. non essential properties for controlling visual display, etc.) eg.:
    Code:
    [Category("Print Settings")]
    The property with the same decoration will not be displayed in Strategies property grid.
    I am forced to use:
    Code:
    [GridCategory("Print Settings")]
    therefore adding it to list of Parameters which is exactly what I am trying to avoid.

    Is there a way of forcing the Category("Something") to be displayed also in Strategies?

    #2
    Hello,

    Thank you for the question.

    I wanted to clairfy the question with you.

    You are correct [Category("Print Settings")] would be used in an indicator and [GridCategory("Print Settings")] would be used in a strategy to achieve the same idea of putting a property in the property grid.

    I am unsure what you mean by:
    therefore adding it to list of Parameters which is exactly what I am trying to avoid.
    Can you please tell me what parameters you are referring to? I am confused by this as you want to add a parameter to the properties grid but you also do not want to add a parameter. Can you clarify this for me please?


    I look forward to being of further assistance.

    Comment


      #3
      Thank you for your reply.

      That's why I used capital P Parameters as in those properties that
      a) Are displayed in the full name and label of the strategy
      b) Are used to optimize on

      To explain with the example - imagine you have 10 properties that are strings representing file path
      var1 = "C:\Users\Folder1\Folder2\Folder3\Folder4\Folder5\ Folder6\Folder7\Folder8\ContentA"
      var2 = "C:\Users\Folder1\Folder2\Folder3\Folder4\Folder5\ Folder6\Folder7\Folder8\ContentB"
      var3 = "C:\Users\Folder1\Folder2\Folder3\Folder4\Folder5\ Folder6\Folder7\Folder8\ContentC"
      var4 = "C:\Users\Folder1\Folder2\Folder3\Folder4\Folder5\ Folder6\Folder7\Folder8\ContentD"
      var5 = "C:\Users\Folder1\Folder2\Folder3\Folder4\Folder5\ Folder6\Folder7\Folder8\ContentE"
      var6 = "C:\Users\Folder1\Folder2\Folder3\Folder4\Folder5\ Folder6\Folder7\Folder8\ContentF"
      var7 = "C:\Users\Folder1\Folder2\Folder3\Folder4\Folder5\ Folder6\Folder7\Folder8\ContentG"
      var8 = "C:\Users\Folder1\Folder2\Folder3\Folder4\Folder5\ Folder6\Folder7\Folder8\ContentH"
      var9 = "C:\Users\Folder1\Folder2\Folder3\Folder4\Folder5\ Folder6\Folder7\Folder8\ContentI"
      var10 = "C:\Users\Folder1\Folder2\Folder3\Folder4\Folder5\ Folder6\Folder7\Folder8\ContentJ"

      If you will include them in one of the GridCategory they will be listed in the full name of the strategy and you won't even see the parameters that are important for you (the screen is to small for that)

      Alternative solution to my problem would be how to stop some properties from displaying in Label and Optimizer.

      There are simply some properties that are not essential to running of the strategy but helpful in Visualising, Debugging, Maintenance, etc. and putting them all in (Capital P) Parameters is an overkill.
      In indicators Parameters are those properties that you use to call them from outside, eg:
      SMA(Period) but beside them you can still have some more Categories like Visual (where you define colors) etc. This is what I am trying to achieve in Strategies.

      Comment


        #4
        To add also information on why is it important to me - I am extending the Strategy base with properties that are used in all my strategies, and these are not "Parameters" only maintenance properties for example "Print to Output Window?"

        Comment


          #5
          Hello,

          Thank you for the clarification.

          You can modify the label you see in the chart but the parameters will still display in a optimizer or strategy backtest because they have been defined as a public property with a grid category.

          To do this you could use the following:

          Code:
          public override string ToString()
          {
          	return Name + "(" + Period + "," + Interval + ")";
          }
          This would change it from the long string to something like "ES 1 minute" Here is a complete example: http://www.ninjatrader.com/support/f...ead.php?t=4749


          If you need to define a public property that does not need to go in the property grid, such as your last post maintenance properties, you would just need to not include the grid category and it would be accessible publicly but not a editable parameter.

          I look forward to being of further assistance.

          Comment


            #6
            Thanks Jesse,

            Yes I am aware of this ways of changing the label but I am afraid this doesn't answer my need. The idea of custom strategy base is that from the perspective of the user it adds additional base functionality but the remaining behaviour remains the same.
            I was hoping for something along the line of some custom decorator like:
            [XmlIgnore, VisualizationOnly] that would exclude property from "Parameters"

            I hope NT8 doesn't have this limitation for Strategies and the behavior will be similar to Indicators.

            Indicators in NT7 give me exactly what I need - if I want the property to be part of "Parameters" I can use GridCategory otherwise I use Category and have them behave the way I need.

            If this is not going to be changed right now please add it as a request for future releases.

            Comment


              #7
              Hello,

              Thank you for the reply.

              I guess I am a little confused on the goal here.

              From your description it sounds like you want to inherit properties or methods that would be shared with any of your strategies or could be added to a strategy by a user, but do not want these properties included in the grid parameters, is this correct?

              If so this would entail using a public class in a namespace that is referenced from the script.

              Can you confirm this is what you are looking to do and I can provide an example of this. If this is not what you are trying to do can you provide an example of the outcome you are looking to achieve?

              I look forward to being of further assistance.

              Comment


                #8
                I want Strategies Property Grid to behave the same way as Indicators Property Grid and I see no reason why they should differ. I want the properties to be part of PropertyGrid but on the same level as existing base properties (eg. CalculateOnBarClose, Enabled, etc.) since that's what I am doing - extending base.

                I'll give you specific simple example, paste following code into your UserDefinedMethods.cs in
                both Indicator folder and Strategy folder (inside of partial class XXX {})
                Code:
                        private bool _isPrint = true;
                
                        public void PrintMe(string message)
                        {
                            if (_isPrint)
                            {
                                Print(message);
                            }
                        }
                
                        [Description("Print To Output Window?\n/False disables printing")]
                        [Category("Debug")]
                        [Gui.Design.DisplayName("Debug Print to Output Window?")]
                        public bool PrintToOutputWindow
                        {
                            get { return _isPrint; }
                            set { _isPrint = value; }
                        }
                Now compile and open any indicator - you will see new Category added "Debug" but this new property "Debug Print to Output Window?" is not part of the Parameters that are used in Indicator's constructor - this is visible both in Label and if you call the indicator from somewhere else (Indicator/Strategy).

                If you do the same with Strategies you will not see the "Debug Print to Output Window?" until you change Category to GridCategory, only now this property becomes part of Parameters and not base properties. This may be bearable if you have 1 of such properties but imagine adding 10 or more including text strings - then even a simple strategy with 1 parameter "Period" suddenly becomes bloated.

                To summarize - I currently can easily extend Indicator base, but I can't do the same with Strategy base without suffering some annoying penalties for doing this.

                You advertise NT8 with giving more power to the user so my hope is that you will abandon this handholding for strategies and let users extend their base properties just as it is possible with Indicators.

                Thanks for showing interest in actually understanding the problem.

                Comment


                  #9
                  Originally posted by gregid View Post
                  With Indicators I can add properties to PropertyGrid using various Categories that are not used as Parameters (eg. non essential properties for controlling visual display, etc.) eg.:
                  Code:
                  [Category("Print Settings")]
                  The property with the same decoration will not be displayed in Strategies property grid.
                  I am forced to use:
                  Code:
                  [GridCategory("Print Settings")]
                  therefore adding it to list of Parameters which is exactly what I am trying to avoid.

                  Is there a way of forcing the Category("Something") to be displayed also in Strategies?
                  Maybe this is the one you are trying to achieve?

                  Example:

                  protected override void Initialize()

                  Code:
                  {
                  this.zz = PASHHLLAlertsStrat(dtbStrength, showSwingLabel, swingSize, swingType, useCloseValues);
                  
                  			[B]this.zz.DivergenceIndicatorMode = DivergenceIndicatorMode;
                  			this.zz.DivergenceDirectionMode = DivergenceDirectionMode;[/B]
                  			Add(this.zz);
                  }
                  And then you add in the Properties region to access it via strategy menu:

                  #region Properties

                  Code:
                          private DivergenceMode divergenceMode = DivergenceMode.False;	
                          [GridCategory("gPASproParameters")]
                          [Description("Represents the indicator for the divergence calculations.")]
                          [Gui.Design.DisplayName("05. Divergence indicator")]
                          public DivergenceMode DivergenceIndicatorMode
                          {
                              get { return divergenceMode; }
                              set { divergenceMode = value; }
                          }
                  	
                          private DivergenceDirection divergenceDirection = DivergenceDirection.Long_Short;	
                          [GridCategory("gPASproParameters")]
                          [Description("Represents the direction the divergences are calculated for.")]
                          [Gui.Design.DisplayName("09. Divergence long and short")]
                          public DivergenceDirection DivergenceDirectionMode
                          {
                              get { return divergenceDirection; }
                              set { divergenceDirection = value; }
                          }
                  If that`s what you was looking for.
                  Last edited by outsource; 04-03-2015, 06:26 PM.

                  Comment


                    #10
                    Thanks outsource but this is not what I am requesting.

                    My request is really quite simple, the problem is it seems to be quite rare approach to extend Strategy Base with base properties. The request is for Strategies to have the same behavior for Category and GridCategory as it is in Indicators. That's it.

                    And since it behaves differently I asked if there is a way for achieving the same behavior.

                    If there is no way to do it now - I request to make this change in NT8. Can someone from NinjaTrader comment on this request?

                    Comment


                      #11
                      Hello gregid,

                      Thank you for clarifying this further.

                      I have tested and see exactly what you mean. I will look into this further and respond here when I have more information.

                      Comment


                        #12
                        Hello gregid,

                        Thank you for your patience.

                        This would not be the case in NinjaTrader 8. Please let me know if I may be of further assistance.

                        Comment


                          #13
                          Originally posted by NinjaTrader_PatrickH View Post
                          Hello gregid,

                          Thank you for your patience.

                          This would not be the case in NinjaTrader 8. Please let me know if I may be of further assistance.
                          Thank you Patrick, but can you clarify what you mean by that.

                          Are you saying that in NT8 I will be able to extend Strategy Base with "base" properties in the proper way - just as it is the case for Indicators now?

                          If that's the case then I am satisfied with that, as I understand there will be no further development of NT7.

                          Comment


                            #14
                            Hello gregid,

                            Thank you for your response.

                            I am not saying there would be no further development of NinjaTrader 7. I am saying this would not be a factor in NinjaTrader 8 where the setting of categories will be changed.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                            0 responses
                            633 views
                            0 likes
                            Last Post Geovanny Suaza  
                            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                            0 responses
                            364 views
                            1 like
                            Last Post Geovanny Suaza  
                            Started by Mindset, 02-09-2026, 11:44 AM
                            0 responses
                            105 views
                            0 likes
                            Last Post Mindset
                            by Mindset
                             
                            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                            0 responses
                            567 views
                            1 like
                            Last Post Geovanny Suaza  
                            Started by RFrosty, 01-28-2026, 06:49 PM
                            0 responses
                            568 views
                            1 like
                            Last Post RFrosty
                            by RFrosty
                             
                            Working...
                            X