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

Remove Draw Object

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

    Remove Draw Object

    Hi,

    I'm not able to delete user created DrawObject (like horisontal line ) by using RemoveDrawObject(string tag). ( I made sure that I'm using the correct Tag )

    Please advice how to achieve that? also how to delete all drawing objects created
    by user.

    Thanks in advance.
    Last edited by bassam; 11-16-2013, 11:39 PM.

    #2
    Hi,

    RemoveDrawObject methods only work for lines drawn in that indicator or strategy. It's not possible to remove manually drawn lines and this is by design.

    Please let me know if you have any questions.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Remove Line

      Hi NinjaTrader_Matthew.

      How to remove the line if it draws the indicator?

      The indicator draws a line when a user to draw a rectangle.

      The line must be drawn at each draw a rectangle.

      And should be deleted by mutations both tick if the rectangle is removed.

      Method RemoveDrawObject ("Avg_line");
      does not delete the line.

      Code:
      foreach (IDrawObject draw in DrawObjects)
      
      {
      		
      if(draw.DrawType == DrawType.Rectangle && draw.UserDrawn)
      					
      {
      
      IRectangle rectangle = (IRectangle) draw;
      					
      if(Close[0] != 0)
      {
      							
      this.H_price = rectangle.StartY;
      					
      this.L_price = rectangle.EndY;
      					
      this.ST_Time = rectangle.StartTime;
      					
      this.ED_Time = DateTime.Now;
      		
      this.avg_line = ((H_price + L_price) / 2);
      
      DrawLine("Avg_line"+draw.Tag, false, ST_Time, avg_line, ED_Time, avg_line, color_avg_line, ds_avg_line, width_avg_line);
      
      }
      }
      }
      Last edited by mawerick; 11-14-2013, 06:43 PM.

      Comment


        #4
        Hi Mawerick,
        Nice idea you're working on there , I'm using horizontal lines rather, may use your idea as well

        You're drawing a line with tag "Avg_line"+draw.Tag , so to delete the line you need to address that line instance with exactly same tag , which in this case "Avg_line"+draw.Tag" not " "Avg_line"....

        While creating the line dont tag it with " draw.Tag" (which I think is better in this case ) OR RemoveDrawObject ("Avg_line"+draw.Tag);

        Comment


          #5
          Originally posted by bassam View Post
          Hi Mawerick,
          Nice idea you're working on there , I'm using horizontal lines rather, may use your idea as well

          You're drawing a line with tag "Avg_line"+draw.Tag , so to delete the line you need to address that line instance with exactly same tag , which in this case "Avg_line"+draw.Tag" not " "Avg_line"....

          While creating the line dont tag it with " draw.Tag" (which I think is better in this case ) OR RemoveDrawObject ("Avg_line"+draw.Tag);
          Hi bassam.

          I prescribe to the tag "Avg_line"+draw.Tag so that the line would have to draw on each rectangle, the creation of a user manual.

          Alas method RemoveDrawObject ("Avg_line"+draw.Tag); does not work. It does not remove the created line.

          I would like to ask the developers of the ninja trader. Why they did not remove the possibility drawing objects by hand and drawing objects indicator menu Drawing Tools\
          Remove Drawing Objects?
          Last edited by mawerick; 11-15-2013, 06:32 AM.

          Comment


            #6
            draw.Tag is unique for every new square created by the user, you have to
            take that into consideration while coding.

            Я с трудностю понял Ваш вопрос, Вам следует аккуратно его на Английском писать если
            Вы хотите получить ответ от разработчиков и лучше всего (если вы не нашли ответ) начать новую тему.
            Last edited by bassam; 11-17-2013, 12:17 AM.

            Comment


              #7
              Originally posted by bassam View Post
              draw.tag is unique for every new square created by the user, you have to
              take that into consideration while coding.

              Я с трудностю понял Ваш вопрос, Вам следует аккуратно его на Английском писать если
              Вы хотите получить ответ от разработчиков и лучше всего (если вы не нашли ответ) начать новую тему.
              Спасибо за совет. Насколько я понял реализовать то, что мне нужно можно только одним путем, это создать нужное количество синтетических объектов и прописать условия, при которых алгоритм будет прорисовывать или удалять объекты. По-другому в Ниндзе это не реализовать.

              Comment


                #8
                Remove manual created draw objects

                Originally posted by bassam View Post
                Hi,

                I'm not able to delete user created DrawObject (like horisontal line ) by using RemoveDrawObject(string tag). ( I made sure that I'm using the correct Tag )

                Please advice how to achieve that? also how to delete all drawing objects created
                by user.

                Thanks in advance.
                This is my solution: https://www.bigmiketrading.com/ninja...tml#post475107

                It works perfectly for me. Consider one "restriction": It deletes all draw objects - also all from any indicator. Due the fact I have my draw objects in an internal C# structure I redraw them immediately and therefore the result is: All manual draw objects are removed!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by RideMe, 04-07-2024, 04:54 PM
                6 responses
                31 views
                0 likes
                Last Post RideMe
                by RideMe
                 
                Started by tkaboris, Today, 05:13 PM
                0 responses
                2 views
                0 likes
                Last Post tkaboris  
                Started by GussJ, 03-04-2020, 03:11 PM
                16 responses
                3,281 views
                0 likes
                Last Post Leafcutter  
                Started by WHICKED, Today, 12:45 PM
                2 responses
                19 views
                0 likes
                Last Post WHICKED
                by WHICKED
                 
                Started by Tim-c, Today, 02:10 PM
                1 response
                10 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Working...
                X