Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Accessing custom drawing object properties
Collapse
X
-
Accessing custom drawing object properties
Hello, is there any way to access and change properties of a custom drawing object such as https://ninjatraderecosystem.com/use...-drawing-tool/ this one. It is overloaded, so I can easily access it, but the author says that in order to change the Text label, the template needs to be changed. Can I access, create and edit a template somehow using code? If not, is it possible to access the object using it's tag like I would any other (picture).
Last edited by Matt Skinner; 06-19-2024, 02:10 AM.Tags: None
-
Hello Matt Skinner,
Thank you for your post.
To clarify, are you trying to change the Text of the drawing object through code? Or are you trying to edit a drawing object template through code?
Are you actually using the Labeled Lines drawing tool you linked, or another script? If you are using another script, I would ask the developer for clarity as whether or not you can access a custom tool's properties / edit them depends wholly on how the developer coded the script.
You can access a drawing object using its tag through code using the DrawObjects collection. The Help Guide page below has sample code demonstrating:
Please let us know if you need further assistance.
-
Yes, I am actually using the Labeled Lines drawing tool that I linked. It is possible with this one.
Comment
-
I undestand that It is possible to access the object, but in my case the object is this( https://ninjatraderecosystem.com/use...-drawing-tool/) custom addon drawing tool. When I use this code (picture).
Error gets shown that drawObject doesn't have any property called "Text". But on the next picture you can clearly see that a property like that exists, how would I go about accessing it? If it is even possible in this case, you mentioned that the creator can decide if properties can be accessed. How can I check that? Thank you for your time!
Comment
-
Hello Matt Skinner,
You would use the DisplayText property.
Please note that this will only print out the text the user typed, and not the price being rendered in text as this isn't exposed. Code:foreach (DrawingTool draw in DrawObjects.ToList()) { if (draw is DrawingTools.LabeledHorizontalLine) { DrawingTools.LabeledHorizontalLine myLine = draw as DrawingTools.LabeledHorizontalLine; Print(myLine.DisplayText); } }
Comment
-
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
602 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
347 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
560 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
559 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment