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 Mindset, 04-21-2026, 06:46 AM
|
0 responses
57 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
78 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
41 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
101 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
61 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Comment