Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to remove last object ?

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

    How to remove last object ?

    Hi,

    i need to remove last object (triangle) designed if a condition is True.
    But if same condition became False i be able to remove all abject using RemoveDrawObject("Tag"), but in this way all triangle will be removed.

    I need to leave all previus triangle and remove only last one after condizion is False.

    The problem is that the condition false may occur in variabile numbers of bar in the next and I can't use "currrentBar".

    How can i do to have it ?
    thanks

    #2
    sniper, so you're essentially drawing muliple unique triangles per bar as long as the condition is true? I would then use a counter to keep track of the condition # triggered in realtime so you could append the tag id as needed and have also a unique id to call RemoveDrawObject with.

    Comment


      #3
      Yes, approximately i need that, but i don't know how create a counter.
      Have you a sample code for that ?
      Thanks

      Comment


        #4
        You would be looking at doing something like, where count would be an integer variable:

        if (myCondition)
        count++

        if (myCondition == false && FirstTickOfBar)
        count = 0;

        This would provide a count of occurrences for condition trigger that happened intra-bar in real-time or replay.

        Comment


          #5
          Thanks but this indicator doesen't work in real time.
          I'll try to programm the conter, but which sintax i need to use to cancel select drawObject ?

          Comment


            #6
            You would still use the RemoveDrawObject call and supply the tag id which object exactly to remove. The counter was meant to be a means of keeping track of created objects intrabar. If you're not working in those conditions, I think CurrentBar should work for you - you would just need to store to bar value which triggered the DrawObject creation to know which one to remove.

            Comment


              #7
              I understood but not all things.... have you a sample code to post me ?
              Thanks

              Comment


                #8
                We could unfortunately not custom create this for you, but a great sample to get started would be found here - http://www.ninjatrader.com/support/f...ead.php?t=3419

                Comment


                  #9
                  ok i got it.
                  Thanks

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  576 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  334 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
                  553 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  551 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X