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 File Sharing > NinjaScript File Sharing Discussion

NinjaScript File Sharing Discussion Discussion for shared NinjaScript files.

Reply
 
Thread Tools Display Modes
Old 07-04-2012, 11:08 AM   #1
pman777
Senior Member
 
Join Date: Nov 2011
Posts: 139
Thanks: 57
Thanked 1 time in 1 post
Default Indicator Parameters

Hi, I'm writing an indicator that draws horizontal lines. I want the line style (eg., dot, dash,etc) and the line color to be selected from a drop down list when loading the indicator on a chart. Can you direct me to an example where this is coded? thanks!
pman777 is offline  
Reply With Quote
Old 07-04-2012, 01:23 PM   #2
koganam
Senior Member
 
Join Date: Feb 2008
Location: Durham, North Carolina, USA
Posts: 3,201
Thanks: 24
Thanked 1,228 times in 999 posts
Send a message via Skype™ to koganam
Default

Quote:
Originally Posted by pman777 View Post
Hi, I'm writing an indicator that draws horizontal lines. I want the line style (eg., dot, dash,etc) and the line color to be selected from a drop down list when loading the indicator on a chart. Can you direct me to an example where this is coded? thanks!
Just program the line in the code's Initialize() method. The line class parameters are available in the dialog box by default. If you need help programming the line syntax, use the Indicator Wizard: it has a specific dialog for creating lines.
koganam is offline  
Reply With Quote
The following user says thank you to koganam for this post:
Old 07-05-2012, 10:46 AM   #3
pman777
Senior Member
 
Join Date: Nov 2011
Posts: 139
Thanks: 57
Thanked 1 time in 1 post
Default

thanks ... I'm new to Ninja script so I'm not sure I'm doing this the best way ... below is the code I have ... can you comment on how I can achieve these drop down boxes with this code? Tx

#region Variables
// Wizard generated variables
private int res01 = 1 ;
private int res02 = 1 ;
private int sup01 = 1 ;
private int sup02 = 1 ;
private int rlt = 1 ;
private int slt = 1 ;



// User defined variables (add any user defined variables below)

#endregion



/// </summary>
protected override void Initialize()
{
CalculateOnBarClose = true;

}

protected override void OnStartUp() // creating an internal reference to the indicator to save resources
{

}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{


DrawHorizontalLine("Res01", false, res01, Color.LightSkyBlue , DashStyle.Dot, rlt);

DrawHorizontalLine("Res02", false, res02, Color.LightSkyBlue , DashStyle.Dot, rlt);

DrawHorizontalLine("Sup01", false, sup01, Color.Peru , DashStyle.Dot, slt);

DrawHorizontalLine("Sup02", false, sup02, Color.Peru , DashStyle.Dot, slt);


}
pman777 is offline  
Reply With Quote
Old 07-05-2012, 10:55 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,409
Thanks: 252
Thanked 975 times in 958 posts
Default

You would need to implement it through the Lines collection - http://www.ninjatrader.com/support/h.../nt7/lines.htm

This is what the indicator wizard would setup for you easily as well...
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
Indicator Parameters neb1998 Indicator Development 1 03-09-2011 02:15 PM
When indicator parameters not in Parameters category MikeInMA Strategy Development 3 11-08-2010 03:24 PM
Varying Indicator Parameters FatCanary Indicator Development 20 07-25-2010 03:05 PM
Indicator Accessing Indicator Where User Has Set Parameters dkrumholz Indicator Development 1 04-27-2010 02:56 PM
Indicator Parameters in a Strategy laocoon Strategy Development 1 10-08-2009 04:11 AM


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