NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 07-18-2012, 03:12 PM   #1
overflowing
Member
 
Join Date: Jul 2011
Posts: 37
Thanks: 11
Thanked 6 times in 3 posts
Default Constrain parameter values?

Is it possible to constrain parameter values to certain acceptable values? For example if I have an int Parameter, can I constrain valid input values to the range 1 to 10. (Similar to ASP.NET validation controls for those familiar)
overflowing is offline  
Reply With Quote
Old 07-18-2012, 03:16 PM   #2
NinjaTrader_AdamP
NinjaTrader Customer Service
 
NinjaTrader_AdamP's Avatar
 
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
Default

overflowing,

There is a section of code in the properties region where you can set a maximum or minimum value.

For example :

Code:
                [Description("Number of bars used for calculation")]
		[GridCategory("Parameters")]
		public int Period
		{
			get { return period; }
			set { period = Math.Max(1, value); }
		}
NinjaTrader_AdamP is offline  
Reply With Quote
The following user says thank you to NinjaTrader_AdamP for this post:
Reply

Tags
parameter

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
Read in GUI parameter values from text file roland_nt Indicator Development 2 04-25-2012 06:51 PM
Reading parameter values Stephan123 Strategy Development 10 11-21-2011 03:21 PM
Is it possible to set parameter values dynamically? pauluk General Programming 2 11-23-2010 10:50 AM
Constrain trendlines with shift key billworld Charting 1 08-09-2010 11:52 AM
Default Parameter Values toptrader Strategy Development 4 09-04-2009 10:30 AM


All times are GMT -6. The time now is 12:59 PM.