The Ellipse drawing starts and then a couple of bars later, when certain parameters are met, I want to "close" the Ellipse.
How do I call *that* particular Ellipse?
I have this, and works about 90%:
if (sc.LineExists(sc.ChartNumber, uid)
several "ellipses" are drawn and closed as expected, however one seems to be hanging from the beginning of the chart to the current index. Which leads me to believe the code has missed this particular LineNumber, or something. Which then leads me to believe that I need more control and how to call each generated Ellipse. Any ideas?
Generally you want to structure your IDs based on what you are trying to do. Using rand() is not the best way to go about it for a number of reasons (though it could work if you have a small number of drawings you are tracking). I usually structure my id using something like this:
int LineID = StudyConst*1000000 + DrawingType*10000 + sc.Index*100 + XYZ;
The above is just an example (modify for your needs). Basically depending what you are trying to do dictates how you want to make the drawing unique and how easy it is to look up again. It really depends how many "active" drawings you have that you need to modify later.
To modify a drawing, you need to save/reuse the id. So in your example, the uid should have been saved to a persist var so you can use it later when you look the drawing up. If you did not save it properly or overwrote it, then your lookup fails and you can not close your original drawing.