Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JesseNinjaTrader Customer Service

    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.
        JesseNinjaTrader Customer Service

        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.
            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Barry Milan, Yesterday, 10:35 PM
            5 responses
            16 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by DanielSanMartin, Yesterday, 02:37 PM
            2 responses
            13 views
            0 likes
            Last Post DanielSanMartin  
            Started by DJ888, 04-16-2024, 06:09 PM
            4 responses
            12 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by terofs, Today, 04:18 PM
            0 responses
            11 views
            0 likes
            Last Post terofs
            by terofs
             
            Started by nandhumca, Today, 03:41 PM
            0 responses
            8 views
            0 likes
            Last Post nandhumca  
            Working...
            X