Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator will be deleted when manually deleting objects drawn by it

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

    Indicator will be deleted when manually deleting objects drawn by it

    Hi,

    I have an indicator which draws rectangles periodically on the chart. When a programmatically-drawn rectangle is selected to be deleted using the mouse, a dialog box pops up asking whether I wanted the indicator/strategy that draws the boxes to be deleted as well. I said no. However, this does not seem to have any effect, when I have actually expected the selected programmatically-drawn rectangle to have been deleted.

    When I choose "yes", the indicator + all the rectangles drawn will be deleted.

    In 6.5, I could choose to delete any items drawn by an indicator without having to delete the whole indicator and everything that goes with it.

    Is there a way to configure in NT7 or is this a bug?

    Thanks.

    #2
    This is expected. I see that the message box text should be improved and will look at that.

    In short

    By default, there is a new property named "AllowRemovalOfDrawObjects" and this is set to false. When false, draw objects created by a script can be deleted but it will deleted the entire indicator. If you set "AllowRemovalOfDrawObjects" to true, you can then remove any objects created by a script without it removing the entire indicator.
    RayNinjaTrader Customer Service

    Comment


      #3
      Thanks!

      Comment


        #4
        Hi,

        Though the "AllowRemovalOfDrawObjects" enable the deletion of the draw objects independently of the indicator that drew it, I faced another issue.

        After my indicator has drawn some rectangles each with a unique tag, I closed down NT7 and saved the workspace. When I opened up NT7, the drawn rectangles are not there anymore.

        This will also happen when I go to the "Indicators..." dialog box. When I exit from the box, the drawn rectangles are all deleted.

        The indicator I created is very straight-forward. It is some kind of utility to help me with my trading rather than a real indicator, I might have "abused" the framework to create this utility.

        Strip to its bare essentials:
        Code:
         
        protected override void OnBarUpdate()
        {
          IRectangle meBox=null;
          if (somecondition) {
            meBox = DrawRectangle(mebox"+someid, true, someStartTime, someStartY, someEndTime, someEndY, Color.Azure, Color.Brown, 2);
            meBox.Locked=true;
          }
        }

        Comment


          #5
          Is the condition still true for drawing when reloading etc..?

          Can you reproduce with just one DrawRectangle() call in OnBarUpdate() ?
          RayNinjaTrader Customer Service

          Comment


            #6
            Originally posted by NinjaTrader_Ray View Post
            Is the condition still true for drawing when reloading etc..?

            Can you reproduce with just one DrawRectangle() call in OnBarUpdate() ?
            The following code draws a rectangle. After that, I change the tag to "mebox1000", recompile, and then perform a "reload ninjascript". The previous rectangle drawn with tag "mebox99" is erased when I would expect it not to be.

            My NT7 is connected to IB.

            Code:
             
            protected override void OnBarUpdate()
            {
              if (!drawn) {
                 DrawRectangle("mebox99", true, new DateTime(2010,4,20),1.3290, new DateTime(2010,4,23), 1.3330, Color.Azure, Color.Brown, 2);
                drawn=true;
              }
            }

            Comment


              #7
              Originally posted by oracle View Post
              The following code draws a rectangle. After that, I change the tag to "mebox1000", recompile, and then perform a "reload ninjascript". The previous rectangle drawn with tag "mebox99" is erased when I would expect it not to be.

              My NT7 is connected to IB.

              Code:
               
              protected override void OnBarUpdate()
              {
                if (!drawn) {
                   DrawRectangle("mebox99", true, new DateTime(2010,4,20),1.3290, new DateTime(2010,4,23), 1.3330, Color.Azure, Color.Brown, 2);
                  drawn=true;
                }
              }
              It would be expected that "mebox99" would be removed and "mebox100" is drawn.
              RayNinjaTrader Customer Service

              Comment


                #8
                Hi Ray,

                Thanks!

                Is there any way to "manually" force programmatically drawn rectangles (or other objects) like in my example, to become "user-drawn", so that they could remain on the chart, even on "reload ninjascript"? Thanks.

                Comment


                  #9
                  I don't believe so however, I will double check with development and report back if I am incorrect.
                  RayNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  598 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  343 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  103 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  557 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  557 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X