![]() |
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
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Feb 2010
Posts: 19
Thanks: 0
Thanked 0 times in 0 posts
|
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. |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
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
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 | |
|
Junior Member
Join Date: Feb 2010
Posts: 19
Thanks: 0
Thanked 0 times in 0 posts
|
Quote:
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.
|
|
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
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;.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 | |
|
Junior Member
Join Date: Feb 2010
Posts: 19
Thanks: 0
Thanked 0 times in 0 posts
|
Quote:
Thank you again, Josh. I found the error message from the Log, and I fixed the problem by changing the CurrentBar numbers. |
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |