Can you tell me how to fix this please:
I've attached a bare bones indicator as an example, but basically it has 2 lines only:
if(Bars.BarsSinceNewTradingDay == 120) Draw.VerticalLine(this,CurrentBar.ToString(),0,Brushes.Yellow,DashStyleHelper.Solid,5);
Also the line is not linked to the indicator. Meaning I can unlock + remove the line manually but the indicator stays. (not wanted)
Removing the indicator gives the popup error again and the drawn line remains on the chart as an orphaned object.
When the draw is enclosed in a dispatcher invoke then the popup issue is fixed, but it creates another problem.
The line is once again detached from the indicator, but now on every reload of the indicator it draws another copy of the line without removing the old one.
So hardly ideal. If the indicator is removed then the popup error appears again and the drawn line remains as an orphan same as above.
So both ways have their multiple issues.
Any solution appreciated.

Comment