Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to: Group Property values together.

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

    How to: Group Property values together.

    Does your indicator have many parameters? When you display them in the Indicators Property dialog you'd perhaps you'd like display some of the parameters in distinct groups.
    This is how you do it.

    Background

    When you create a new property you can use attributes to customise how it will be display to the user. Attributes are the words in the square brackets prior to the definition of your property ( eg: yOffset. in the code below)

    Description: sets the text that you want displayed in the help area when the user clicks on this property.
    DisplayName: lets you change the property name so it is nicer to read. ie put in Spaces. As the names are sorted alphabetically, if you use different letters you can change the order of the parameters. If that is insufficient, you can prefix one or more tab characters "\t" to the name. ie: "\tText Position". The property with the most tab chars goes to the top of the list.
    Category: it is safest to leave this as "Parameters" but that is what this post is about.

    [Description("Y Offset of text from Bottom of Panel")]
    [Category(
    "Parameters - Font")]
    [Gui.Design.DisplayName(
    "Text Position")]
    publicfloat YOffset
    {
    get { return yOffset; }
    set { yOffset = Math.Min(Math.Max(0,value),1000); }
    }

    Changing the Category Value
    If you set the Category attribute to something other than "Parameters " then a new group is created in the Indicators Property dialog.

    This provides the following benefits:-
    1. All Properties with the same Categoryname get grouped together.
    2. The groups can be shrunk with the +/- button to save space.
    3. These property values don't display up the top of your chart, but you can still see the properties with "Parameters" grouping.
    This also is a disadvantage:-
    1. These properties can't be accessed from other parts of Ninja. So if you intend to use your indicator in a Strategy or Market Analyzer & can't leave this with a default value, you should not set its category name to something other than "Parameters"
    Ninja v7.0 Breaking change


    Note: From what I read. In Ninja V7.0 they have improved support for this.
    1. The [Category("...")] attribute will be renamed to be GridCategory("...")]
    2. But the syntax changes from [Category("Parameters")] to be
      [GridCategory(
      "<AnyText>")]
    Please plan to update your indicators. You may also want to ship a 64 bit version of your indicators too.

    Disclaimer: While is looks like this will be supported in v7.0. In v6.5 this is unsupported. Please test thoroughly.

    I hope you find this useful
    Dave
    Last edited by David Lean; 11-23-2009, 05:42 PM.

    #2
    David,

    Thank you for this post.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    579 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    334 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    554 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    551 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X