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 cmoran13, 04-16-2026, 01:02 PM
      0 responses
      36 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      23 views
      0 likes
      Last Post PaulMohn  
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      162 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      96 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      152 views
      2 likes
      Last Post CaptainJack  
      Working...
      X