Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    BertrandNinjaTrader Customer Service

    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.
        BertrandNinjaTrader Customer Service

        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.
            BertrandNinjaTrader Customer Service

            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
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  ok i got it.
                  Thanks

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by mgco4you, Today, 09:46 PM
                  1 response
                  2 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by wzgy0920, Today, 09:53 PM
                  0 responses
                  3 views
                  0 likes
                  Last Post wzgy0920  
                  Started by Rapine Heihei, Today, 08:19 PM
                  1 response
                  8 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by Rapine Heihei, Today, 08:25 PM
                  0 responses
                  6 views
                  0 likes
                  Last Post Rapine Heihei  
                  Started by f.saeidi, Today, 08:01 PM
                  1 response
                  9 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Working...
                  X