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

Indicator categories collapse, CategoryDefaultExpanded/CategoryExpanded has no effect

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

    Indicator categories collapse, CategoryDefaultExpanded/CategoryExpanded has no effect

    Hi,

    I scanned all issues regarding ways to start the Indicator parameter screen with group/category collapse. The only valid but unsupported solution I saw, was the use of [CategoryDefaultExpanded(false)] and/or [CategoryExpanded("Group/Category Name", false)]. I did try them both, with or without the "Gui." in front.

    While the [Gui.CategoryOrder("Group/Category Name", orderValue)] works, the Expanded has no effect, the my code below. Am I doing something wrong?

    I did see a suggestion by @jeronymite, on issue 1150613 from 2012, to use WpfPropertyGrid class, which contains a collection of CategoryItem in Categories, and a collection of PropertyItem in Properties, but I a not clear of where do I need to add this code:

    Code:
    for (int i = 0; i < propgrid.Properties.Count; i++)propgrid.Properties[i].IsExpanded = <true or false, as you wish>;
    for (int i = 0; i < propgrid.Categories.Count; i++)
    propgrid.Categories[i].IsExpanded = <true or false, as you wish>;
    This is my code:
    Code:
    #region #### GUI Order & Expanded  ####
    [Gui.CategoryDefaultExpanded(false)]
    [Gui.CategoryOrder("Trends Params", 110)]
    [Gui.CategoryOrder("Signals Params", 120)]
    [Gui.CategoryOrder("Setup #1 Dir Mom Break Rule", 210)]
    [Gui.CategoryOrder("Setup #2 NonDir DivMom Break Rule", 220)]
    [Gui.CategoryOrder("Setup #3 NonDir MTFDetour Break Rule", 230)]
    [Gui.CategoryOrder("Setup #4 Dir Trend Rule", 240)]
    [Gui.CategoryOrder("Setup #5 Initial Trend Rule", 250)]
    [Gui.CategoryOrder("Trends Visual", 1110)]
    [Gui.CategoryOrder("Signals Visual", 1120)]
    [Gui.CategoryOrder("Setups Visual", 1200)]
    
    [Gui.CategoryExpanded("Trends Params", false)]
    [Gui.CategoryExpanded("Signals Params", false)]
    [Gui.CategoryExpanded("Setup #1 Dir Mom Break Rule", false)]
    [Gui.CategoryExpanded("Setup #2 NonDir DivMom Break Rule", false)]
    [Gui.CategoryExpanded("Setup #3 NonDir MTFDetour Break Rule", false)]
    [Gui.CategoryExpanded("Setup #4 Dir Trend Rule", false)]
    [Gui.CategoryExpanded("Setup #5 Initial Trend Rule", false)]
    [Gui.CategoryExpanded("Trends Visual", false)]
    [Gui.CategoryExpanded("Signals Visual", false)]
    [Gui.CategoryExpanded("Setups Visual", false)]
    #endregion
    
    [TypeConverter("NinjaTrader.NinjaScript.Indicators. BW4U.BWTTraderProperties")]
    public class MyIndicator: Indicator
    {
    ...
    }
    Last edited by Shai Samuel; 08-09-2022, 04:53 AM.

    #2
    Hi Shai Samuel,

    You can use this code with the property name to collapse:

    Code:
    [B][Gui.CategoryExpanded("[/B]Trends Params[B]", false)][/B]
    After you have added this code in you indicator, compile the indicator.

    If is not taking effect, make a copy of the file UI.xml before start with the next step.

    Add all property names you want to collapse before continue. When you finish, compile the indicator.

    You will need to close NinjaTrader and remove from start to end the information related to the indicator name saved in the configuration file named UI.xlm in the path "Documents\NinjaTrader 8"

    To do this please use the search function in your editor.
    After save the file you can open NinjaTrader and check if the property names are collapsed.

    If you follow the steps correctly, you'll be able to see the changes.

    This is the only partial solution to this problem than is working until right now and you will need to do this with every indicator and property name you want be collapse when you open the indicator properties window.

    Example:

    Click image for larger version

Name:	Delete code to collapse.png
Views:	218
Size:	159.8 KB
ID:	1211586

    Comment


      #3
      Hello Shai Samuel,

      The CategoryDefaultExpanded attribute is currently not supported/documented so what you are running into is generally expected. There are some attributes which can be found however they are not all fully used or may nor work in certain tools.

      I am unaware if the comment joselube001 made works or not but you can certainly give that a try if you wanted, unfortunately there is no supported solution that I can provide to have that working.

      If you need to have a collapsed section its generally best to use a ExpandableObject however that is also not fully supported and may not work with all tools that can use a property grid.

      JesseNinjaTrader Customer Service

      Comment


        #4
        Thank you joselube001 for the details. Is this is something I need to do once, or do I have to return on the process each change I am doing?

        Comment


          #5
          You are welcome!

          You will need to do this once, but with every new property name o editing existing propety names you will need to add or edit the code to collapse it before compile the file to avoid the previous situation. If you forgot this, and you have compiled the file with out the code to collapse it, you will need to do all the steps again...

          Please, confirm us if this is working for you to help another people with the same issue!
          Last edited by joselube001; 08-10-2022, 01:58 PM.

          Comment


            #6
            Thank you again @joselube001. Your suggestion was very easy to implement, and it worked 100%.

            Comment


              #7
              To build on what joselube001​ discovered:

              Every time a property grid is edited, the <PropertyGridCategoryStates> section of "UI.xml" is updated with configuration information.

              The information in this section overrides the category attributes such as the ones in the code below.

              In my Ninja installation, the "PropertyGridCategoryStates" section had almost 2000 lines and contained indicator names which had been deleted long ago. Clearing out this entire section in the xml was the solution I chose.

              Below are the sorting and expansion category attributes for the properties of an example indicator.
              Also see "Attributes" section of the NinjaTrader 8 help documentation

              Code:
                 #region Category values
                  [Gui.CategoryDefaultExpanded(false)]
                  [Gui.CategoryOrder("Parameters", 1), Gui.CategoryExpanded("Parameters", true)]
                  [Gui.CategoryOrder("Dom Color", 2)]
                  [Gui.CategoryOrder("Big Dom", 3)]
                  [Gui.CategoryOrder("Info Block", 4)]
                  [Gui.CategoryOrder("Context Menu", 5)]
                  #endregion​
              Last edited by Bidder; 03-28-2024, 06:13 PM. Reason: spelling

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by rhyminkevin, Today, 04:58 PM
              0 responses
              7 views
              0 likes
              Last Post rhyminkevin  
              Started by lightsun47, Today, 03:51 PM
              0 responses
              5 views
              0 likes
              Last Post lightsun47  
              Started by 00nevest, Today, 02:27 PM
              1 response
              12 views
              0 likes
              Last Post 00nevest  
              Started by futtrader, 04-21-2024, 01:50 AM
              4 responses
              48 views
              0 likes
              Last Post futtrader  
              Started by Option Whisperer, Today, 09:55 AM
              1 response
              15 views
              0 likes
              Last Post bltdavid  
              Working...
              X