Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Hidding indicators

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

    Hidding indicators

    Hello,

    I am coding a Toolbar with a buttom that hides the indicators of the chart. It works perfectly by removing the "Visible" tick in the default Ninjatrader indicators but not for those purchased from external programmers. Does it have something to do that are not * .CS and are * .DLL or that are inside a folder inside the indicator tree?

    Thank you very much

    #2
    Hello rafaelmarcos,

    Thank you for the post.

    How are you currently toggling the indicators in code? This would not really be enough information to understand the problem fully.

    There is nothing I would be aware of that would cause a problem between an assembly indicator versus the source code indicator in contrast to what you are asking. If you are accessing the objects of the chart, this could be if you are using casts that you instead need to use Dynamic type casts. You may look into this page for further details on some known items between an assembly and standard NinjaScript code: https://ninjatrader.com/support/help...ghtsub=dynamic

    If that is not related, could you provide a sample of how you toggle the indicators? that may provide more insight into what is happening, or would at least allow me to test the situation further.

    I look forward to being of further assistance.

    Comment


      #3
      Buttom action is coded like this;

      foreach (var obj in chartWindow.ActiveChartControl.ChartObjects)
      {
      var indi = obj as Indicator;
      if (indi != null)
      {
      if (indiSwitch)
      {
      indi.IsVisible = false;
      }
      else if (!indiSwitch)
      {
      indi.IsVisible = true;
      }
      }
      }
      indiSwitch = !indiSwitch;
      chartWindow.ActiveChartControl.InvalidateVisual();
      ForceRefresh();

      Comment


        #4
        Hello,

        Thank you for providing the sample.

        I wanted to check with you as I dont have the indicators being missed, have you at this point tried using Prints to see if the indicators are showing up in this collection at all?

        This is likely the next step I could suggest or to print all of the objects in the collection and see what they are. This will clear up if this is due to casting or if they are just not present in the collection. If they are not present, they could not be referenced otherwise if they are listed it may just be the cast or other checks causing them to be missed.

        Could you test the following and see what the output is or mainly if the external NinjaScript items are showing up?

        Code:
        foreach (var obj in chartWindow.ActiveChartControl.ChartObjects)
        {
        	Print(obj.GetType().Name);
        }
        You may also want to try with dynamic:

        Code:
        foreach (dynamic obj in chartWindow.ActiveChartControl.ChartObjects)
        {
        	Print(obj.GetType().Name);
        }

        I look forward to being of further assistance.
        Last edited by NinjaTrader_Jesse; 04-23-2018, 02:19 PM.

        Comment


          #5
          Hello Jesse,

          I could send you the indicators..

          Thanks!
          Rafa

          Comment


            #6
            Hello,

            Thank you for the reply.

            Yes, you can certainly upload items to the forum if you wish, if you have a simplified example you can export and upload, I could test it.

            I would still suggest that you try using Prints from your script to address where the problem is starting from. The print provided should highlight if the items are accessible or not, and if they are it will highlight if your cast is failing.


            I look forward to being of further assistance.

            Comment

            Latest Posts

            Collapse

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