Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Custom DrawingTools.OffsetLine gets broken after viewing the drawing tools menu
Collapse
X
-
Custom DrawingTools.OffsetLine gets broken after viewing the drawing tools menu
Hey, I created a custom DrawingTools.OffsetLine, which inherits from the normal line. I needed it for an indicator in which I want multiple lines to be drawn at different Y pixel offsets, and since Draw.Line() doesnt have a Y pixel offset (like Draw.Text() does) I created this class, which I'm attaching. The idea is simple, you can pass it an offset, and when its rendering, it will render at that pixel offset. It works when running the script, however, the offset disappears from every OffsetLine in the chart after i open the drawing tools menu to, for example, make one of the lines not locked. My guess is that lines get redrawn by ninjatrader after any drawingtools change in the menu, but I'm not completely sure what is happening, or how to fix it. Any help or any tip to point me in the right direction is greatly appreciated.Tags: None
-
Hello lauStormtech,
Some investigating with prints would need to be done further understand the issue.
As far a new instance being created, you can check this by generating an instance ID.
Are other properties reverting to previous values as well, or just the private variables you have added?Chelsea B.NinjaTrader Customer Service
-
Chelsea, thanks a lot for answering! The link you provided was enough to help me fix this. On pressing DrawingTools menu OK button, something similar happens to what happens when your press ok in the indicator menu (as is discussed in the post you provided). I'm not completely sure what pressing OK causes, but the OnEdited method is called in the LineOffset object. With this method, i have access to the previous LineOffset offset property, so i just set the current offset to the value of the previous offset. Not the prettiest solution, but it works. Thanks again!
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
558 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
324 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 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
545 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment