Draw.Line(this, "LineRGT"+CurrentBar, true, 1, Open[1], -10, Open[1], Brushes.Pink, DashStyleHelper.Dot, 2);
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to Update Line Property Like endBarsAgo , brush ?
Collapse
X
-
How to Update Line Property Like endBarsAgo , brush ?
From my Indicator , i am drawing Line using below code. From my indicator, I need to update the color and length of Line on some condition. Kindly share your input.
Draw.Line(this, "LineRGT"+CurrentBar, true, 1, Open[1], -10, Open[1], Brushes.Pink, DashStyleHelper.Dot, 2);Tags: None
-
Hello nandhumca,
Thanks for your first post and welcome to the NinjaTrader forums!
In order to update the line, you will need to save or recreate the "tag name" and then use the Draw.Line() method with the new parameters and the same tag name.
For example:
if (conditions to draw the line)
{
Draw.Line(this, "LineRGT"+CurrentBar, true, 1, Open[1], -10, Open[1], Brushes.Pink, DashStyleHelper.Dot, 2);
myTagname = "LineRGT"+CurrentBar;
}
if (conditions to update that specific line)
{
Draw.Line(this, "LineRGT"+CurrentBar, true, 20, Open[1], 1, Open[1], Brushes.Magenta, DashStyleHelper.Dot, 2);
}
-
Hello nandhumca,
Thanks for your patience.
I've attached a working example of creating a line and then printing the properties of that line. Please apply this to a fast chart such as 10-second bars with real time data. On the chart, as soon as the first bar closes you will see the line drawn and in the Ninjascript output window, you will see the values of the (X, Y) anchors.
DrawLineCheck.zip
- Likes 1
Comment
-
Hi Paul,
After setting AllowRemovalOfDrawObjects as true, i can able to remove the line drawn by indicator without removing indicator from chart. Now I want to know that will there be any event triggrered for removal and will that be captured in indicator ?
Comment
-
Hello nandhumca,
Thanks for your reply.
Nice catch!
You could observe that the chart objects collection list has changed.
Here is a link to an example script in post #9 that I tested with the script I previously provided and adding AllowRemovalOfDrawObjects=true;
- Likes 1
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
580 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
336 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
103 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
554 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
552 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment