Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Removing last draw object, but not all of them?

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

    Removing last draw object, but not all of them?

    Hi, How would I be able to remove just my last draw object, but not all of them.

    If ( User Defined)
    {
    Draw.Text(this, "PVolD" + CurrentBar.ToString(), false,
    Convert.ToString(PowerPlay(Brushes.Transparent, Brushes.Transparent)[1]), 0,
    High[0]+2*TickSize, 0, Brushes.Black, myFont, TextAlignment.Center,
    Brushes.Transparent, Brushes.Transparent, 2);

    RemoveDrawObject("PVolD"+ (????????));
    }


    Thanks, Woody.

    #2
    Hello Woody,

    Thanks for your post.

    When you write your text, store the current bar number in another int variable (maybe called myLastBar).

    For example:

    DrawText (all your stuff....);
    myLastBar = CurrentBar;


    Then to remove:

    RemoveDrawObject ("PVold"+myLastBar);

    Alternatively, instead of you using CurrentBar to create a unique tag name, create and use an integer counter that is increment each time you draw text to create the unique tag name and this way the integer counter will have the last value used.

    Comment


      #3
      Thanks Paul. That did the trick. Very, Very helpful. Thanks again, Woody!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by sjsj2732, 03-23-2026, 04:31 AM
      0 responses
      77 views
      0 likes
      Last Post sjsj2732  
      Started by NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      313 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      314 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      149 views
      1 like
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      114 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Working...
      X