Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Custom DrawingTools.OffsetLine gets broken after viewing the drawing tools menu

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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.
    Attached Files

    #2
    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

    Comment


      #3
      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 geddyisodin, Today, 05:20 AM
      2 responses
      16 views
      0 likes
      Last Post geddyisodin  
      Started by hazylizard, Today, 08:38 AM
      0 responses
      7 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by Max238, Today, 01:28 AM
      5 responses
      43 views
      0 likes
      Last Post Max238
      by Max238
       
      Started by giulyko00, Yesterday, 12:03 PM
      3 responses
      13 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by habeebft, Today, 07:27 AM
      1 response
      16 views
      0 likes
      Last Post NinjaTrader_ChristopherS  
      Working...
      X