Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Clear DrawTextFixed

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

    Clear DrawTextFixed

    I've been using the following to clear what I previously wrote with DrawTextFixed:

    Code:
    DrawTextFixed("Target", "", TextPosition.Center, Color.Green, new Font("Arial",16), Color.Transparent, Color.Transparent, 5);
    but then as the chart updates, bars that get drawn in the top left, are sort of washed out - I don't think I'm using DrawTextFixed correctly to clear the text that was there. How should it be done?

    #2
    Originally posted by reynoldsn View Post
    I've been using the following to clear what I previously wrote with DrawTextFixed:

    Code:
    DrawTextFixed("Target", "", TextPosition.Center, Color.Green, new Font("Arial",16), Color.Transparent, Color.Transparent, 5);
    but then as the chart updates, bars that get drawn in the top left, are sort of washed out - I don't think I'm using DrawTextFixed correctly to clear the text that was there. How should it be done?
    Change the areaOpacity to 0?

    Comment


      #3
      Originally posted by reynoldsn View Post
      I've been using the following to clear what I previously wrote with DrawTextFixed:

      Code:
      DrawTextFixed("Target", "", TextPosition.Center, Color.Green, new Font("Arial",16), Color.Transparent, Color.Transparent, 5);
      but then as the chart updates, bars that get drawn in the top left, are sort of washed out - I don't think I'm using DrawTextFixed correctly to clear the text that was there. How should it be done?
      Assign it to an IText object and you can delete the IText object when you do not need it any more.

      Comment


        #4
        Hello reynoldsn,

        Thank you for your post.

        You can remove the object when needed using RemoveDrawObject() and call the tag. For information on RemoveDrawObject() please visit the following link: http://ninjatrader.com/support/helpG...drawobject.htm

        Please let me know if you have any questions.

        Comment


          #5
          OK, good to know about RemoveDrawObject, however, there is still something wrong. Despite calling RemoveDrawObject right before DrawText, I can still see the old text underneath the new label. It appears that RemoveDrawObject isn't always removing the old label.

          Comment


            #6
            Hello reynoldsn,

            Thanks for your post.

            If you use any draw method and use the same object tag name, the first object is automatically removed and then the new applied object is drawn. Repeated calls continue the pattern and at any moment one and only object with the tag name will be on the chart.

            If you wanted to keep objects on the chart then you would create a unique tag name for each instance. This can be done by using something line "Tag name" + CurrentBar creating a unique tag as each bar completes.

            RemoveDrawObject("tag name") will remove the specified "tag name" object.

            RemoveDrawObjects() will remove all draw objects.

            Comment


              #7
              Just a follow up - when I remove my strategy, the DrawText objects remain on the chart - is there a way to get them to clear?

              Comment


                #8
                I reproduced the problem. Please see image. You can see that despite I'm using only one range name, "Range", there is another label drawn behind. Why is it doing this? And here is the code:

                Code:
                RemoveDrawObject("Range");
                DrawTextFixed("Range", string.Format("Strategy range: {0}", 
                	Math.Round(hi - lo,2)), 
                	TextPosition.BottomLeft, Color.Green, new Font("Arial",16), Color.Blue, Color.DarkGray, 10);
                Attached Files

                Comment


                  #9
                  Hello reynoldsn,

                  Thanks for your post.

                  I have been unable to replicate the issue you are showing.
                  As mentioned previously, if you use the same tag name you shouldn't need to remove the prior object using the RemovedDrawObject() method.

                  So that I can further assist, please share your complete code here or feel free to send in to PlatforSupport[at]Ninjatrader[dot]Com with Atten Paul and this link:http://ninjatrader.com/support/forum...ad.php?t=75542

                  Comment

                  Latest Posts

                  Collapse

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