Thank you for your reply,
Your suggestion will hide or show all drawings including the drawings made from any indicator, thank you for it.
Now, what I need is to hide or show the drawings made from the "TrendLines" indicator only.
I'm applying your suggestion to the "TrendLines" indicator zone script, but I have the same results.
Here is the code with the problem hiding or showing the "TrendLines" indicator:
private void btnTrendLinesClick(object sender, RoutedEventArgs e)
{
System.Windows.Controls.Button button = sender as System.Windows.Controls.Button;
if (button != null)
{
// toggle TrendLines indicator
foreach (var obj in chartWindow.ActiveChartControl.ChartObjects)
{
var indi = obj as TrendLines;
if (indi != null)
{
if (indiSwitch)
{
indi.IsVisible = false;
indiSwitch = true;
//Print(indiSwitch + "' is hidden.");
}
else if (!indiSwitch)
{
indi.IsVisible = true;
indiSwitch = false;
//Print(indiSwitch + "' is visible.");
}
}
}
indiSwitch = !indiSwitch;
chartWindow.ActiveChartControl.InvalidateVisual();
ForceRefresh();
}
}

Comment