Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom Indicator Visibility

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

    Custom Indicator Visibility

    Hello. I am messing around with the ChartCustomSidePanelExample. I have done an extensive search on all existing forums. I have placed a button in the panel and want to have a custom indicator named MyCustomIndicator's visibility be toggled on and off just like you can do manually on any indicator via the Indicator Properties Visible checkbox. The whole indicator becomes invisible with this UI procedure. Our indicator has some Draw.Regions (from Series<double>), Draw.Text (from Series<string>) and plots from Series<double>. When I click the button only the Series<double> plots are turned off, the other objects of the indicator stay visible such as the Regions and Text. I use the same code to populate the list box and the output window. The regions don't show up in the list box but they do in the output and I am not even sure where the Rays are coming from. I am filtering out the Text strings in the list box and output window as there are a lot. But you can still see the Draw.Text above each bar as well as the Draw.Regions that should be off. The Series<double> plots are off in the attached picture. Below is the sample code. Thank you for your assistance.

    Tom

    Code:
    protected void Button2_Click(object sender, RoutedEventArgs e)
    {
    foreach (var myObj in chartWindow.ActiveChartControl.ChartObjects)
    {
    if (myObj != null)
    {
    if (myObj.Name != "Text") Print("ChartObjects = " + myObj.Name);
    if (myObj.Name == "MyCustomIndicator")
    {
    if (showIndicator)
    {
    myObj.IsVisible = false;
    Print("Hide Indicator");
    }
    else if (!showIndicator)
    {
    myObj.IsVisible = true;
    Print("Show Indicator");
    }
    showIndicator = !showIndicator;
    }
    }
    }
    
    if(button2.Content == "Hide")
    {
    button2.Content = "Show";
    }
    else
    {
    button2.Content = "Hide";
    }
    }
    Click image for larger version

Name:	capture.png
Views:	935
Size:	99.5 KB
ID:	1150865
    Intelligent Trader Inc.
    NinjaTrader Ecosystem Vendor - Artificial Intelligence Based Indicators

    #2
    Hello intelligenttrader,

    I would recommend having a look at the updated version of this script SampleWPFModifications.
    https://ninjatrader.com/support/foru...07#post1124507

    The button should causing the wpf objects to be removed from the chartGrid.Children, the column removed from the grid, and the remaining items shifted over. In SampleWPFModifications this is demonstrated on lines 692 to 700.

    It appears the unsupported code you have, attempts to hide an entire indicator and it's plots, but does not attempt to change the WPF.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea and thanks for the update modifications. I am trying to toggle the visibility of the MyCustomIndicator via the button in the MyCustomPanel indicator. I don't want to remove the controls from the panel as lines 692 to 700 do. What ways can you suggest for visibility of the entire indicator as once.
      Intelligent Trader Inc.
      NinjaTrader Ecosystem Vendor - Artificial Intelligence Based Indicators

      Comment


        #4
        Hello intelligenttrader,

        There are no methods made by NinjaTrader to modify WPF in NinjaScript.

        Any changes to WPF made by script, will also have to be changed back by the same script.

        If you are wanting to hide plots, the IsVisible property can be set to false.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I just want to make the indicator invisible on the chart. I don't want to remove it from the chart. I can do it manually by going into the properties dialog and unchecking Visible. See the EMA example. In the image visible.png I have loaded the EMA. In invisible.png I have uncheck the Visible checkbox and the indicator is now invisible. Are you saying I can't programmatically go through a collection of indicator objects and make them visible / invisible?

          Click image for larger version

Name:	visible.png
Views:	676
Size:	89.6 KB
ID:	1151120Click image for larger version

Name:	invisible.png
Views:	652
Size:	85.7 KB
ID:	1151121
          Intelligent Trader Inc.
          NinjaTrader Ecosystem Vendor - Artificial Intelligence Based Indicators

          Comment


            #6
            Hello intelligenttrader,

            The indicator's IsVisible affects things rendered in the RenderTarget of the chart, such as plots, lines, and drawing objects. This would not affect WPF such as buttons, checkboxes, etc.

            But yes, you can set the IsVisible from within a script to hide plots and drawing objects.

            Looping through the indicators on a chart is possible, but is undocumented and not officially supported.
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            605 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            351 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            560 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            561 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X