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 sidlercom80, 10-28-2023, 08:49 AM
        172 responses
        2,279 views
        0 likes
        Last Post sidlercom80  
        Started by Irukandji, Yesterday, 02:53 AM
        2 responses
        17 views
        0 likes
        Last Post Irukandji  
        Started by adeelshahzad, Today, 03:54 AM
        0 responses
        4 views
        0 likes
        Last Post adeelshahzad  
        Started by Barry Milan, Yesterday, 10:35 PM
        3 responses
        13 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by WeyldFalcon, 12-10-2020, 06:48 PM
        14 responses
        1,430 views
        0 likes
        Last Post Handclap0241  
        Working...
        X