Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Parameter sequencing

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

    Parameter sequencing

    Applies to NinjaTrader 7

    Indicator and strategy parameters (user defined inputs) will always be displayed in alphabetical order in any indicator/strategy dialog window as default behavior. If you ever come across the need to have these parameters sorted in a non-alphabetical order you can custom sort it by modifying the parameter's DisplayName tag.

    In the NinjaScript Editor, expand the the "Properties" region of your code where all of your parameters are defined. In this example, this will be our our Properties section:
    Code:
    [Description("Number of standard deviations")]
    [GridCategory("Parameters")]
    public double NumStdDev
    {
         get { return numStdDev; }
         set { numStdDev = Math.Max(0, value); }
    }
       
    [Description("Numbers of bars used for calculations")]
    [GridCategory("Parameters")]
    public int Period
    {
         get { return period; }
         set { period = Math.Max(1, value); }
    }
    To sort the two parameters you can modify the DisplayName tag with "\t" excluding the quotations. "\t" will not be included as part of your parameter display but instead is used as a switch for the purpose of sorting. Cascading these switches will allow us to sort the parameters in whatever manner we wish.

    For example, if we wanted "Period" to be before "Number of standard deviations" we would do this:
    Code:
    /// <summary>
    /// </summary>
    [Description("Number of standard deviations")]
    [GridCategory("Parameters")]
    [Gui.Design.DisplayName ("\t# of std. dev.")]
    public double NumStdDev
    {
         get { return numStdDev; }
         set { numStdDev = Math.Max(0, value); }
    }
     
    /// <summary>
    /// </summary>
    [Description("Numbers of bars used for calculations")]
    [GridCategory("Parameters")]
    [Gui.Design.DisplayName ("\t\tPeriod")]
    public int Period
    {
         get { return period; }
         set { period = Math.Max(1, value); }
    }
    Please take note that the first parameter to show up will be the parameter with the most "\t" cascaded in its DisplayName.

    For more information on how to arrange the indicator/strategy's chart label, please see this reference sample: http://ninjatrader.com/support/forum...ead.php?t=4749
    Last edited by NinjaTrader_Jesse; 08-24-2015, 11:32 AM.
    Josh P.NinjaTrader Customer Service

    #2
    Applies to NinjaTrader 8

    Indicator and strategy parameters (user defined inputs) will always be displayed in an order that the user specifies in the NinjaScript file.

    In the NinjaScript Editor, expand the "Properties" region of your code where all of your parameters are defined. In this example, this will be our Properties section:

    Code:
    [Range(1, int.MaxValue), NinjaScriptProperty]
    [Display(ResourceType = typeof(Custom.Resource), Name = "Fast", GroupName = "NinjaScriptStrategyParameters", [COLOR="Red"]Order = 0[/COLOR])]
    public int Fast
    { get; set; }
    
    [Range(1, int.MaxValue), NinjaScriptProperty]
    [Display(ResourceType = typeof(Custom.Resource), Name = "Slow", GroupName = "NinjaScriptStrategyParameters", [COLOR="Red"]Order = 1[/COLOR])]
    public int Slow
    { get; set; }
    In this case, the Fast parameter will show up as the first parameter with the Slow parameter showing as the second.

    To switch the order around, we could modify Order. If we change Slow's Order to 0 and Fast's Order to 1 as shown below ...

    Code:
    [Range(1, int.MaxValue), NinjaScriptProperty]
    [Display(ResourceType = typeof(Custom.Resource), Name = "Fast", GroupName = "NinjaScriptStrategyParameters", [COLOR="red"]Order = 1[/COLOR])]
    public int Fast
    { get; set; }
    
    [Range(1, int.MaxValue), NinjaScriptProperty]
    [Display(ResourceType = typeof(Custom.Resource), Name = "Slow", GroupName = "NinjaScriptStrategyParameters", [COLOR="red"]Order = 0[/COLOR])]
    public int Slow
    { get; set; }
    ... the Slow property will show first and the Fast property second.
    Zachary G.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Lumbeezl, 01-11-2022, 06:50 PM
    31 responses
    817 views
    1 like
    Last Post NinjaTrader_Adrian  
    Started by xiinteractive, 04-09-2024, 08:08 AM
    5 responses
    14 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by swestendorf, Today, 11:14 AM
    2 responses
    6 views
    0 likes
    Last Post NinjaTrader_Kimberly  
    Started by Mupulen, Today, 11:26 AM
    0 responses
    6 views
    0 likes
    Last Post Mupulen
    by Mupulen
     
    Started by Sparkyboy, Today, 10:57 AM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X