Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Removing Text painted by indicator

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

    Removing Text painted by indicator

    Hi there,

    Is it possible to remove text painted on to a chart which was added by an indicator? The text to be removed would be on a previous days chart, say all days after 2 days ago.

    For example, this code added a number below a candlestick on a chart...

    Draw.Text(this, CurrentBar.ToString(), true, _barCntr.ToString(), 0, _textYStartingPoint, _pixelsAboveBelowBar, _tmpBrush, myFont, TextAlignment.Center, null, null, 1);


    The problem is, over time there would be too many text elements added to the chart, so it would be good to be able to delete text from previous days.

    Thank you!




    #2
    Hello globaljobber,

    If you use the CurrentBar as the Tag you could use a for loop to remove objects pretty easily.

    This would be pretty resource demanding so you would likely want to only do this once at the start of the new session.
    Code:
    if (Bars.IsFirstBarOfSession)
    {
        int startBar = CurrentBar - 1; 
    
        for(int i = startBar; i > 0; i--)
        {
            RemoveDrawObject(i.ToString());
        }
    }



    Comment


      #3
      Thank you for your reply.

      Would the RemoveDrawObject command remove ALL objects from ALL indicators on the chart, or just the objects associated with the actual indicator within which the RemoveDrawObject command was called?

      Thanks!

      Comment


        #4
        Hello globaljobber,

        That would relate to the objects that script has drawn.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        23 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        20 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        14 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        10 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        41 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X