Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Changing IsVisible on Indicator in code doesn't hide draw objects.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Originally posted by ntbone View Post
    The code to hide the drawing objects is very straight forward and won't fix your problem unless you are using the drawing objects. If you are calling AddPlot to render your visuals then the code that I have won't help you.

    Code:
    private void ShowIndicator(bool isVisible)
    {
    foreach(var chartObject in chartWindow.ActiveChartControl.ChartObjects)
    {
    var indicator = chartObject as Indicator;
    if(indicator != null && indicator.DrawOnPricePanel)
    {
    indicator.IsVisible = isVisible;
    ToggleIndicatorDrawingObjectVisibilty(indicator, isVisible);
    }
    }
    
    // forces the chart to redraw.
    chartWindow.ActiveChartControl.InvalidateVisual();
    }
    
    private void ToggleIndicatorDrawingObjectVisibilty(Indicator indicator, bool isVisible)
    {
    foreach(var obj in indicator.DrawObjects)
    {
    if(obj.DrawnBy == indicator)
    {
    obj.IsVisible = isVisible;
    }
    }
    }
    When added to my indie there is an error on two lines 'The name 'chartWindow' does not exist in the current context.' are there missing starements or lines to specify when it is called or to what method these functions will be called to.

    Comment


      #17
      chartWindow is of type Chart and was a member variable of the class the code was copied from. I had downloaded ABtoolBar from here https://ninjatraderecosystem.com/use...ers-and-wicks/ and modified it as the code in there to hide indicators wasn't hiding their drawing objects, just their plots. The Chart object for an indicator can be obtained via OwnerChart property.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      637 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      366 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      107 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      569 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      571 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X