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

Add a HorizontalLine object

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

    Add a HorizontalLine object

    Hi-

    I can add a HorizontalLine via a script by calling Draw.HorizontalLine factory method. But the indicator then owns it and I cannot delete teh line later without removing my indicator. How do I add the line such that once added, its as if I created it via the drawing tool, free to modify and remove if I wish?

    Many thanks,

    Nick.

    #2
    Hello ptptrader,

    Thanks for your message.

    You can set the DrawObject's IsLocked property to false so the user can move this object, but removing the object would have to be done from the script that owns it. You could consider to have the script add some buttons that call RemoveDrawObject() to remove that line should the user want to delete it.

    Code:
    Dot myDot = Draw.Dot(this, "tag1", true, 0, Low[0] - TickSize, Brushes.Red);
    myDot.IsLocked = false;
    RemoveDrawObject - https://ninjatrader.com/support/help...drawobject.htm

    Buttons Examples - http://ninjatrader.com/support/forum...327#post499327

    Please let us know if we can be of further assistance.
    JimNinjaTrader Customer Service

    Comment


      #3
      Thanks Jim...is there any event I can intercept at all rather than creating a button?

      I have zones for different perspectives that I draw in across multiple charts. So I am trying to create an indicator that I can use to create new zones from csv string, but allow me to quickly delete a line as I am doing my analysis just as I would the drawing tool approach. I can put a button on the screen but thats two clicks; would be ideal to be able to avoid that...

      Is there is a better approach? (I can start again).

      Comment


        #4
        Hello ptpatrader,

        There would not be a supported way for a NinjaScript drawn drawing object to be deletable by the user without having that script removed, so I could not offer any additional suggestions.

        If there is anything else I can do to help, please let me know.
        JimNinjaTrader Customer Service

        Comment


          #5
          Understood. I also asked if there is anything (event or method) I can intercept/override that I could use to know the user is trying to delete an object?

          Comment


            #6
            Hello ptptrader,

            There would not be anything documented that I could point to here, but I do stand corrected in post #4. You could set DrawnBy to null and this will have the drawing objected treated like it is a user drawn object.

            Please try the following:

            Code:
            Dot myDot = Draw.Dot(this, "tag1", true, 0, Low[0] - TickSize, Brushes.Red);
            myDot.IsLocked = false;
            myDot.DrawnBy = null;
            We will be happy to assist you further.
            JimNinjaTrader Customer Service

            Comment


              #7
              Ah fantastic Jim this is very helpful. Apologies for the late response, I missed this completely.

              Nick.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by CortexZenUSA, Today, 12:53 AM
              0 responses
              1 view
              0 likes
              Last Post CortexZenUSA  
              Started by CortexZenUSA, Today, 12:46 AM
              0 responses
              1 view
              0 likes
              Last Post CortexZenUSA  
              Started by usazencortex, Today, 12:43 AM
              0 responses
              5 views
              0 likes
              Last Post usazencortex  
              Started by sidlercom80, 10-28-2023, 08:49 AM
              168 responses
              2,266 views
              0 likes
              Last Post sidlercom80  
              Started by Barry Milan, Yesterday, 10:35 PM
              3 responses
              13 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Working...
              X