I created a simple script to demonstrate this behavior (see attached).
The OnBarUpdate method contains the following code:
if ((Count - 2 == CurrentBar))
{
Print(string.Format("(OnBarUpdate) DrawObjects.Count : {0}, CurrentBar: {1}", DrawObjects.Count, CurrentBar));
foreach (DrawingTool trendline in DrawObjects)
{
Print(string.Format("Object Tag: {0}", trendline.Tag.ToString()));
}
}
2) I added two rays to my chart with tags, "Ray 2" and "Ray 3"
3) On the chart, I reloaded the NinjaScript successively a handful of times using F5.
The output of the script is shown in the attachment.
The first time the script was reloaded, it found only 1 DrawObject; Ray 2
The second time, it found 2 DrawObjects, Ray 2 and Ray 3
The third time, it found 1 DrawObject, Ray 2.
I have a different script where I am having trouble detecting multiple trendlines reliably, because of this issue.
Any help would be appreciated.

Comment