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

trouble removing Text objects

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

    trouble removing Text objects

    Get message:
    Error on calling 'OnBarUpdate' method for indicator '[routine name]' on bar 14: Collection was modified; enumeration operation may not execute.

    I occasionally need to take all drawn text off the screen, Each message has a unique tag. but
    RemoveDrawObject(tag) gives this message when I try to loop through all text tags.

    Bar 14 is just an arbitrary staring point. Message occurs for any value.

    #2
    Hello roland_nt,
    Thanks for writing in and I am happy to assist you.

    You cannot delete any object the collections while in a foreach loop. Thus you cannot use the RemoveDrawObjest(tag) code within the foreach loop.

    This is a more of a c# query and please refer here for more details
    I can't get to the bottom of this error, because when the debugger is attached, it does not seem to occur. Collection was modified; enumeration operation may not execute Below is the code. This i...


    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Originally posted by roland_nt View Post
      Get message:
      Error on calling 'OnBarUpdate' method for indicator '[routine name]' on bar 14: Collection was modified; enumeration operation may not execute.

      I occasionally need to take all drawn text off the screen, Each message has a unique tag. but
      RemoveDrawObject(tag) gives this message when I try to loop through all text tags.

      Bar 14 is just an arbitrary staring point. Message occurs for any value.
      This thread deals with that exact issue. If you read it, you will get the code to do what you want. http://www.ninjatrader.com/support/f...ad.php?t=44194

      Comment


        #4
        deleting draw objects

        Koganam

        Thanks. Very helpful.
        Roland
        :

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Waxavi, Today, 02:00 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by alifarahani, Today, 09:40 AM
        5 responses
        23 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Kaledus, Today, 01:29 PM
        4 responses
        12 views
        0 likes
        Last Post Kaledus
        by Kaledus
         
        Started by gentlebenthebear, Today, 01:30 AM
        3 responses
        16 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by PhillT, Today, 02:16 PM
        2 responses
        7 views
        0 likes
        Last Post PhillT
        by PhillT
         
        Working...
        X