I have a condition (A) where I number bars using "Draw.Text".
I simply add a '1', '2' ....'3' on top of bars, these bars are not necessarily consecutive.
Each time this condition is true and I add a number of the top of the bar and I add the "CurrentBar" to a List object:
private List<int> ListSell; .... if condition A is true { Draw.Text(this, "tag.CD.S " + CurrentBar, true, "" + counter, 0, High[0] + (((ATR(14))[0])*1.75), 20, Brushes.Red, new SimpleFont("Arial", 12),TextAlignment.Center,Brushes.Transparent, Brushes.Transparent, 0); ListSell.Add(CurrentBar) }
In order to do this....I use a For loop which runs through the list object to pull all the List values (CurrentBars) which I can use for RemoveDrawObject argument
If condition B is true { for (int i = 1; i == ListSell.Count; i ++) { RemoveDrawObject( "tag.CD.S " + (ListSell[i]) ); } }
However, this doesnt seem to delete the annotations.
Do you see any obvious issues with this technique ?
1) If I use: RemoveDrawObject( "tag.CD.S 196"), where i actually type the bar number, I have no issues and the individual drawing object is removed, but if i use RemoveDrawObject( "tag.CD.S " + (ListSell[i]) ), then the drawing object isn't removed.
2) I thought perhaps I need to use a "ToString", but this doesn't delete the drawing either:
RemoveDrawObject( "tag.CD.S " + (ListSell[i].ToString()) );
Any thoughts and insight would be appreciated
Thanks
A
Comment