NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 03-14-2010, 07:43 AM   #1
dkrumholz
Member
 
Join Date: Aug 2009
Location: Princeton NJ
Posts: 87
Thanks: 10
Thanked 0 times in 0 posts
Default Accessing User Parameters

I want to color price bars based on the value of the RSI. How should I construct the test to see if the value of the RSI is above or below the parameters the user selected for the upper and lower values? What variables hold the user selections for upper and lower parameters?
dkrumholz is offline  
Reply With Quote
Old 03-14-2010, 10:59 AM   #2
NinjaTrader_Ben
NinjaTrader Customer Service
 
NinjaTrader_Ben's Avatar
 
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
Default

Hello,

These are found if you click on the grey Variables near the top of the code or the Properties box near the bottom. They are light grey.
NinjaTrader_Ben is offline  
Reply With Quote
Old 03-14-2010, 06:38 PM   #3
dkrumholz
Member
 
Join Date: Aug 2009
Location: Princeton NJ
Posts: 87
Thanks: 10
Thanked 0 times in 0 posts
Default Which Variable to Reference?

This is the variables section -

Code:
 
#region Variables
private DataSeries avgUp;
private DataSeries avgDown;
private DataSeries down;
private int period = 14;
private int smooth = 3;
private DataSeries up;
#endregion

This is the properties section -

Code:
 
#region Properties
/// <summary>
/// </summary>
[Browsable(false)]
[XmlIgnore()]
public DataSeries Avg
{
get { return Values[1]; }
}
/// <summary>
/// </summary>
[Browsable(false)]
[XmlIgnore()]
public DataSeries Default
{
get { return Values[0]; }
}

/// <summary>
/// </summary>
[Description("Numbers of bars used for calculations")]
[Category("Parameters")]
public int Period
{
get { return period; }
set { period = Math.Max(2, value); }
}
/// <summary>
/// </summary>
[Description("Number of bars for smoothing")]
[Category("Parameters")]
public int Smooth
{
get { return smooth; }
set { smooth = Math.Max(1, value); }
}
#endregion


The RSI has two lines being drawn. The user can specify values for both the upper and lower lines. A gif of the settings that can be specifed by the user is attached.

What variables would hold the value specified by the user for the upper and lower lines? What code would I use to test if the value of the RSI was above or below each of those two user specfied values.

if RSI > ????????

or if RSI <= ??????????

Thanks
Attached Images
File Type: gif ScreenHunter_01 Mar. 14 20.27.png (32.8 KB, 9 views)
dkrumholz is offline  
Reply With Quote
Old 03-15-2010, 05:03 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
Default

drumholz, you could access those for example with this snippet call -

Code:
 
if (rsi > Lines[1].Value) ...
This would access the second line's value, as the index is zero based...
NinjaTrader_Bertrand is offline  
Reply With Quote
Reply

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
Creating parameters for user input NinjaTrader_Josh Indicator Development 13 08-12-2010 02:47 AM
User Defined Input Parameters erikp Suggestions And Feedback 6 10-04-2009 10:02 AM
Accessing Misc parameters ZenMachine General Programming 3 04-02-2009 03:29 PM
Accessing the user defined plot color parameter from within an indicator. Elliott Wave Indicator Development 1 04-15-2008 11:29 PM
Creating User Defined Input Parameters NinjaTrader_Josh Tips 0 02-23-2008 05:02 AM


All times are GMT -6. The time now is 07:54 PM.