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.
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 mlarocco, Today, 11:12 AM
|
1 response
28 views
0 likes
|
Last Post
|
||
Started by futurenow, 12-06-2021, 05:49 PM
|
19 responses
1,010 views
0 likes
|
Last Post
![]()
by Redders
06-16-2025, 06:02 AM
|
||
Started by mathfrick2023, 05-08-2025, 12:51 PM
|
8 responses
124 views
0 likes
|
Last Post
![]()
by Yogaman
06-14-2025, 06:01 PM
|
||
Started by several, 04-22-2025, 05:21 AM
|
1 response
285 views
0 likes
|
Last Post
![]()
by Lukasxgtx
06-13-2025, 06:00 AM
|
||
Started by NTEducationTeam, 06-12-2025, 02:30 PM
|
0 responses
45 views
0 likes
|
Last Post
![]() |
Comment