The indicator updates on every tick. The drawings are placed on the chart if a certain set of conditions are met, and once drawn on the chart a flag is set to true to note that the drawing exists. A separate variable continues to track whether or not the conditions still apply with each incoming tick.
On the first tick of the next bar (before the condition flag and drawing existence flags are reset for the new bar), there is a check of the condition flag and the drawing existence flag. If the conditions were not met on the last tick of the previous bar and the flag for the existence of a drawing is true, then the RemoveDrawObject() function is called for that specific tag ID (e.g., RemoveDrawObject("entryTag")). I added a Print to confirm that I'm reaching the conditional code block which contains the remove function.
Is there something obvious that I might be doing wrong, or are you aware of any bugs with this function? Again, when I refresh the indicator, objects are correctly removed.
Thank you.
Regards,

Comment