• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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, 10:32 AM.
    JoshNinjaTrader 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", Order = 0)]
    public int Fast
    { get; set; }
    
    [Range(1, int.MaxValue), NinjaScriptProperty]
    [Display(ResourceType = typeof(Custom.Resource), Name = "Slow", GroupName = "NinjaScriptStrategyParameters", Order = 1)]
    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", Order = 1)]
    public int Fast
    { get; set; }
    
    [Range(1, int.MaxValue), NinjaScriptProperty]
    [Display(ResourceType = typeof(Custom.Resource), Name = "Slow", GroupName = "NinjaScriptStrategyParameters", Order = 0)]
    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 simonkloot, Today, 04:14 AM
    1 response
    4 views
    0 likes
    Last Post NinjaTrader_ChrisSch  
    Started by percma, Today, 02:00 AM
    0 responses
    4 views
    0 likes
    Last Post percma
    by percma
     
    Started by antrux, Yesterday, 06:26 PM
    0 responses
    5 views
    0 likes
    Last Post antrux
    by antrux
     
    Started by kevinenergy, Yesterday, 03:34 PM
    0 responses
    16 views
    0 likes
    Last Post kevinenergy  
    Started by Bidder, Yesterday, 01:50 PM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_PatrickG  
    Working...
    X