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 > Indicator Development

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

Reply
 
Thread Tools Display Modes
Old 12-25-2011, 10:17 PM   #1
zeller4
Senior Member
 
Join Date: Sep 2008
Posts: 185
Thanks: 20
Thanked 2 times in 2 posts
Default Plotting Lines through Zones

Hello,

The attached sketch shows lines I've drawn using the following simple code:



Code:
if (!newblueline && GoodDirection[0] == 1 && GoodDirection[1] != 1) 
			{
					newblueline = true;
					newredline = false;
					barcountstart = CurrentBar;
					startline = Close[0];
			}
			if (newblueline && GoodDirection[0] != 1 && GoodDirection[1] == 1) 
			{
					barcountend = CurrentBar;
					endline = Close[0];
					//newblueline = false;
					
			}
			if (!newredline && GoodDirection[0] == -1 && GoodDirection[1] != -1) 
			{
					newredline = true;
					newblueline = false;
					barcountstart = CurrentBar;
					startline = Close[0];
			}
			if (newredline && GoodDirection[0] != -1 && GoodDirection[1] == -1) 
			{
					barcountend = CurrentBar;
					endline = Close[0];
					//newredline = false;
					
			}
			
			if (newblueline) DrawLine("newlineblue"+CurrentBar,true,(CurrentBar - barcountstart),startline,(CurrentBar - barcountend), endline, Color.Blue,DashStyle.DashDot,3);
			if (newredline) DrawLine("newlinered"+CurrentBar,true,(CurrentBar - barcountstart),startline,(CurrentBar - barcountend), endline, Color.Red,DashStyle.DashDot,3);
GoodDirections are DataSeries indicated by backcolors (1 is blue, -1 is orchid/purple, 0 is blank)


http://screencast.com/t/Dxt256mz

Please advise what needs to change with the code to plot one red line in the orchid/purple zone, one blue line in the blue zone, and no plots in the blank zone.
Thanks.
Kirk
Attached Images
File Type: jpg 6E 12-11 (4 Range) 11_4_2011.jpg (110.7 KB, 20 views)
Last edited by zeller4; 12-26-2011 at 08:24 AM.
zeller4 is offline  
Reply With Quote
Old 12-27-2011, 07:26 AM   #2
NinjaTrader_Brett
NinjaTrader Customer Service
 
NinjaTrader_Brett's Avatar
 
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
Default

Hello,

Thanks for the note.

Although I cannot offer exact code you would need to change to do this I can point you in the right direction to do this on your own.

It appears you are using DrawLine() to do this therefor you needed to add code so that you do not start Drawing a Line during this time or that and existing line does not have a start time before the time and an end time after the time. Since you defint the start point and end points of each line you draw you would need to make this change in your code you use to decide to DrawLine() or not to DrawLine().

Let me know if I can be of further assistance.
NinjaTrader_Brett 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
Plotting Lines at nearest 1/8 centries cbart_1 Indicator Development 18 09-26-2011 10:51 AM
plotting lines in a strategy kjackson Strategy Development 1 03-21-2010 07:43 PM
Plotting My Own Lines cbart_1 Indicator Development 8 08-12-2009 01:19 PM
Plotting different lines in different panels zenith1107 General Programming 1 05-13-2009 06:33 AM
Bars and Lines not Plotting RandyT General Programming 4 10-09-2008 09:25 AM


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