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 Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        670 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        379 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        111 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        575 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        582 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X