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 02-10-2010, 07:58 AM   #1
dowhk
Junior Member
 
Join Date: Feb 2010
Posts: 19
Thanks: 0
Thanked 0 times in 0 posts
Question DrawLine()

Hi,

I tried to draw a line on a chart using the DrawLine(), the code worked in a Strategy but not in an Indicator. Is this correct or do I miss something?

A prompt reply is appreciated.
dowhk is offline  
Reply With Quote
Old 02-10-2010, 08:49 AM   #2
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

DrawLine() works regardless of if it is from an indicator or a strategy. I suggest you check in your Control Center logs for any errors.

I suspect you may be running into this: http://www.ninjatrader-support2.com/...ead.php?t=3170
NinjaTrader_Josh is offline  
Reply With Quote
Old 02-10-2010, 09:22 AM   #3
dowhk
Junior Member
 
Join Date: Feb 2010
Posts: 19
Thanks: 0
Thanked 0 times in 0 posts
Question

Quote:
Originally Posted by NinjaTrader_Josh View Post
DrawLine() works regardless of if it is from an indicator or a strategy. I suggest you check in your Control Center logs for any errors.

I suspect you may be running into this: http://www.ninjatrader-support2.com/...ead.php?t=3170

Thank you Josh.

I ran it like this, but still did not work.
How do I know my NT has errors, where is the log file located?
All other NT functions are fine.

Code:
 
if (CurrentBar > 2)
{ 
 
  DrawLine("tag1", false, 10, 230, 0, 200,
  Color.LimeGreen, DashStyle.Dot, 2);
  DrawHorizontalLine("tag2", 200, Color.Black);
}
Last edited by dowhk; 02-10-2010 at 09:26 AM.
dowhk is offline  
Reply With Quote
Old 02-10-2010, 09:34 AM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Control Center has a Log tab. You can review them there.

Your code will not work. Your code is saying to draw the line 10 bars ago. On bar #5, 10 bars do not exist yet so it cannot draw and will have errors. You need to use at least if (CurrentBar < 10) return;.
NinjaTrader_Josh is offline  
Reply With Quote
Old 02-10-2010, 09:48 AM   #5
dowhk
Junior Member
 
Join Date: Feb 2010
Posts: 19
Thanks: 0
Thanked 0 times in 0 posts
Talking

Quote:
Originally Posted by NinjaTrader_Josh View Post
Control Center has a Log tab. You can review them there.

Your code will not work. Your code is saying to draw the line 10 bars ago. On bar #5, 10 bars do not exist yet so it cannot draw and will have errors. You need to use at least if (CurrentBar < 10) return;.

Thank you again, Josh.

I found the error message from the Log, and I fixed the problem by changing the CurrentBar numbers.
dowhk 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
Drawline wcmaria Indicator Development 6 06-24-2009 05:28 AM
drawline to nowhere gg80108 Indicator Development 9 05-01-2009 12:43 PM
Drawline Does Not Work doug_p Charting 3 01-06-2009 08:57 AM
Drawline puppeye Indicator Development 2 12-22-2008 06:49 AM
DrawLine Help PrTester Charting 1 02-09-2008 08:41 PM


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