What solution can I use ?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
how to format a isGlobal line
Collapse
X
-
how to format a isGlobal line
I am writing a simple indicator that draws lines but I would need to change the color, dash type and width. Checking the reference I can't find an overload of Draw.Line() that would allow me to draw this line, format it graphically and make it visible on all graphs in the same tool. How is this possible ?
What solution can I use ?Tags: None
-
Hello sn0z33r,
You can save the object to a variable and then set properties on it (that are not in the overload parameters).
For example:
Draw.Line(NinjaScriptBase owner, string tag, bool isAutoScale, int startBarsAgo, double startY, int endBarsAgo, double endY, bool isGlobal, string templateName)
if (CurrentBar > 5)
{
Line myLine = Draw.Line(this, "myLine" + CurrentBar, true, 5, Close[5], 0, Close[5], true, null);
myLine.Stroke = new Stroke(Brushes.Green, DashStyleHelper.Dash, 5);
}
This comes from the code sample in the help guide.
Chelsea B.NinjaTrader Customer Service
Comment
-
ok, it works fine but i had to declare myLine as var and force cast to NinjaTrader.NinjaScript.DrawingTools.Line
var myLine = Draw.Line(this, "myLine" + CurrentBar, true, 5, Close[5], 0, Close[5], true, null) as NinjaTrader.NinjaScript.DrawingTools.Line;
myLine.Stroke = new Stroke(Brushes.Green, DashStyleHelper.Dash, 5);
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
648 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
369 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
108 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
572 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
573 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment