NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Educational Resources > Tips

Tips Official NinjaScript tips and tricks

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 01-01-2008, 02:36 PM   #1
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default Parameter sequencing

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://www.ninjatrader-support.com/v...3814#post23814
NinjaTrader_Josh is offline  
Reply With Quote
The following 4 users say thank you to NinjaTrader_Josh for this post:
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Controlling Parameter Sequencing whitmark General Programming 8 03-28-2009 10:58 AM
Color Input Parameter aslane Indicator Development 2 12-24-2007 01:49 PM
Parameter selection lists ThePatientOne Indicator Development 3 05-11-2007 08:48 AM
Parameter sorting/ordering rtrader Suggestions And Feedback 3 04-08-2007 05:27 PM
Problem with 'Parameter Type' set to Price codeye Miscellaneous Support 5 12-09-2005 07:06 AM


All times are GMT -6. The time now is 02:02 AM.