![]() |
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: Oct 2008
Posts: 23
Thanks: 0
Thanked 0 times in 0 posts
|
I have the following code which I would like to draw a circle below the bar the crosses and also draw a line.
if (CrossAbove(EMA(14), EMA(145), 1)) DrawDot(CurrentBar.ToString(), true, 0, Low[0] - TickSize, Color.Red); DrawLine("tag1", false, 10, 1000, 0, 1001, Color.LimeGreen, DashStyle.Solid, 1); When I run the indicator it works when just the drawDot line is in, when I add the drawline it does not draw the dot or the line. Is there a reason for this? Thanks |
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
wcmaria,
You need to place them within { } brackets for the if-statement. Code:
if (CrossAbove.....)
{
DrawDot(...);
DrawLine(...);
}
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Oct 2008
Posts: 23
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks for the input.
When I include the following code if (CrossAbove (EMA(14), EMA(145), 1) ) { DrawDot(CurrentBar.ToString(), true, 0, Low[0] - TickSize, Color.Red); Print((MAEnvelope(0.5,25).LowerBand[0])); DrawLine(CurrentBar.ToString(), false, 10, 1000, 0, 1001, Color.LimeGreen, DashStyle.Solid, 1); } it does not work (shows nothing on the screen), but when I hash out the print and drawline lines it prints the dot in the correct place. |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Oct 2008
Posts: 23
Thanks: 0
Thanked 0 times in 0 posts
|
It seems in my case I cannot use both the Drawdot and DrawTriangle within the same if statement. It will only work if I use one or the other.
if (CrossAbove (EMA(14), EMA(145), 1) ) { DrawDot(CurrentBar.ToString(), true, 0, High[0] + TickSize, Color.Red); //Print((MAEnvelope(0.5,25).LowerBand[0])); DrawTriangleDown(CurrentBar.ToString(), true, 0, Low[0] - TickSize, Color.Red); } Is there a way to draw both a circle below and a several triangles at different prices above the same bar? |
|
|
|
|
|
#5 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
The reason is because you are using the exact same object name. You need to use separate names if you want two separate objects.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Jul 2008
Location: East Rochester, NY
Posts: 899
Thanks: 0
Thanked 19 times in 17 posts
|
Try something like this:
if (CrossAbove (EMA(14), EMA(145), 1) ) { DrawDot("MyDot" + CurrentBar.ToString(), true, 0, High[0] + TickSize, Color.Red); //Print((MAEnvelope(0.5,25).LowerBand[0])); DrawTriangleDown("MyTriangle" + CurrentBar.ToString(), true, 0, Low[0] - TickSize, Color.Red); } |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Oct 2008
Posts: 23
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks for the responses everyone. It worked.
Will |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 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 into the future? | higler | General Programming | 4 | 09-10-2008 12:27 PM |
| DrawLine Help | PrTester | Charting | 1 | 02-09-2008 08:41 PM |