Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Removing Draw Text?

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

    Removing Draw Text?

    Could some help me with this. I'm trying to remove the last draw text! It will draw the the text, but can't seem to remove it?

    private int lastPBar = 0;
    private int thisPBar = 0;



    if (CurrentBar ==0)
    return;
    if(PU[0] < PU[1])
    {
    if(PU[0] == 100000)
    lastPBar = 0;
    else
    {
    lastPBar = thisPBar;
    }

    thisPBar = CurrentBar;

    Draw.Text(this,"PUp"+CurrentBar.ToString(), true,"P", 0,
    Low[0]-LabelOffset*TickSize,0, Brushes.Green, trifont,
    TextAlignment.Center, Brushes.Transparent,
    Brushes.Transparent, 1);
    if(lastPBar >0)
    RemoveDrawObject("PUp"+ (CurrentBar-lastPBar));
    }
    Thanks,

    #2
    Hello woodyfox,

    I'm not certain that I am understanding.

    Are you trying to draw an object and then immediately remove that object on the same bar?

    If you print the string you are using does this match the tag name of the drawn object?

    (Likely the CurrentBar value is changing)
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      No, the last draw.text under same tag

      Comment


        #4
        Hello woodyfox,

        With the code provided it appears that the Drawing object will be removed on the same bar it is drawn on if lastPBar is greater than 0.

        Please provide the output from the prints.

        What is the output from the string used for RemoveDrawObject?

        What is the tag of the drawn object?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Chelsea, Could you be so kind to provide an example where a bar value is stored at CurrentBar and then can be referenced at a later time? (to remove draw.text) Im hoping there is an existing indicator I can use as an examlple.
          Thanks,

          Comment


            #6
            Hello woodyfox,

            Unfortunately, I am not aware of a specific script that has custom logic to remove drawing objects by storing the CurrentBar number.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              OK. Any hints, Tips, etc. Someone has had to ask if its possible to remove prior bars Draw.Text. Any examples on forum. Any help would be helpful.
              Thanks,

              Comment


                #8
                Chelsea,
                Disregard last entry. I figured it out, my code had a small mistype. Thanks anyway.

                Comment


                  #9
                  Hello woodyfox,

                  Its always helpful to debug the code by using prints. This would be the fastest way to fix the code to what you are wanting.

                  Below is a link to a forum post that demonstrates using prints to understand behavior.


                  After some research I found the AutoTrendHNT8 indicator included with the AutoTrendHDemoNT8 strategy on the forums stores bar numbers and uses this to remove drawing objects.
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

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