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

NinjaScriptProperty - Not working as expected...

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

    NinjaScriptProperty - Not working as expected...

    Hello,

    I recently built an indicator with 21 NinjaScriptProperty's and under the "Display" attribute each has been given a separate "Order" variable starting with 1 and ending with 21. They are then grouped together in sets of 3 using the "GroupName" variable beginning with "Line One" and ending with "Line Seven."

    By doing this I expect to see them listed in the GUI with Line One at the top and Line Seven at the bottom but instead they are listed in alphabetical order according to their "GroupName." So they appear in the following order:

    Line Five
    Line Four
    Line One
    Line Seven
    Line Six
    Line Three
    Line Two

    Is this the expected behavior for the "Order" and "GroupName" variables?

    Here is a copy and paste of the first two sets of property's:

    // Property Settings...
    #region Properties

    // Line one properties...
    [NinjaScriptProperty]
    [Display(Name="Time Frame", Description="Line One's time frame parameter.", Order=1, GroupName="Line One: ")]
    public CandleSelection.Time TimeFrameOne
    {
    get { return timeFrameOne; }
    set { timeFrameOne = value; }
    }

    [NinjaScriptProperty]
    [Display(Name="Candle Position", Description="Line One's position parameter.", Order=2, GroupName="Line One: ")]
    public CandleSelection.Position CandlePositionOne
    {
    get { return candlePositionOne; }
    set { candlePositionOne = value; }
    }

    [NinjaScriptProperty]
    [Display(Name="Bars Ago (0 is current bar)", Description="Line One's historical bars parameter.", Order=3, GroupName="Line One: ")]
    public int BarsLookBackOne
    {
    get { return barsLookBackOne; }
    set { barsLookBackOne = value; }
    }

    // Line two properties...
    [NinjaScriptProperty]
    [Display(Name="Time Frame", Description="Line Two's time frame parameter.", Order=4, GroupName="Line Two: ")]
    public CandleSelection.Time TimeFrameTwo
    {
    get { return timeFrameTwo; }
    set { timeFrameTwo = value; }
    }

    [NinjaScriptProperty]
    [Display(Name="Candle Position", Description="Line Two's position parameter.", Order=5, GroupName="Line Two: ")]
    public CandleSelection.Position CandlePositionTwo
    {
    get { return candlePositionTwo; }
    set { candlePositionTwo = value; }
    }

    [NinjaScriptProperty]
    [Display(Name="Bars Ago (0 is current bar)", Description="Line Two's historical bars parameter.", Order=6, GroupName="Line Two: ")]
    public int BarsLookBackTwo
    {
    get { return barsLookBackTwo; }
    set { barsLookBackTwo = value; }
    }

    It continues like this for all seven lines...

    Thank you for your help! NT provides EXCELLENT service on these forums.

    Ben

    #2
    Hi Ben, thanks for writing in. We use an open-source property grid manager to make this control. By default, the categorized properties are listed alphabetically. The most straightforward solution is to add alphanumerically order labels e.g. GroupName="1. Line One: " GroupName="2. Line Two: ". There may be a way to change this, but you would need to look through the Wiki for this tool to see if that would be possible:

    https://github.com/DenysVuika/WPG/wiki (publicly available)

    Kind regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Thank you, I'll give it a look!

      Comment


        #4
        benjamin$ This should do what you want: https://ninjatrader.com/support/help...rattribute.htm

        For example:
        Code:
            [Gui.CategoryOrder(XXGroupName, 0)]   // XXGroupName is just a string with a group name in it, starting with, e.g., the letter X
            [Gui.CategoryOrder(AAGroupName, 1)]   // AAGroupName is just a string with a group name in it, starting with, e.g., the letter A
        The XX group will be listed first, then the AA group. You don't need to use string variables, but it does make it easier. You could just use string constants, if you prefer.

        Thanks.
        Multi-Dimensional Managed Trading
        jeronymite
        NinjaTrader Ecosystem Vendor - Mizpah Software

        Comment


          #5
          Originally posted by jeronymite View Post
          benjamin$ This should do what you want: https://ninjatrader.com/support/help...rattribute.htm

          For example:
          Code:
          [Gui.CategoryOrder(XXGroupName, 0)] // XXGroupName is just a string with a group name in it, starting with, e.g., the letter X
          [Gui.CategoryOrder(AAGroupName, 1)] // AAGroupName is just a string with a group name in it, starting with, e.g., the letter A
          The XX group will be listed first, then the AA group. You don't need to use string variables, but it does make it easier. You could just use string constants, if you prefer.

          Thanks.
          I was hopeful this would work but after implementing it as described I get an error (CA0592) that says, "Attribute 'Gui.CategoryOrder' is not valid on this declaration type. It is only valid on 'class, interface' declarations."

          Seems like some room for improvement in this area since correct GUI order is kind of important.

          Comment


            #6
            Hi benjamin, you apply it to the class, not the properties. I attached my test script for reference. jeronymite thanks for finding that for us.

            Kind regards,
            -ChrisL
            Attached Files
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_ChrisL View Post
              Hi benjamin, you apply it to the class, not the properties. I attached my test script for reference. jeronymite thanks for finding that for us.

              Kind regards,
              -ChrisL
              This worked! Thanks for the advice!

              And thank you jeronymite

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              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
              9 views
              0 likes
              Last Post terofs
              by terofs
               
              Started by nandhumca, Today, 03:41 PM
              0 responses
              6 views
              0 likes
              Last Post nandhumca  
              Started by The_Sec, Today, 03:37 PM
              0 responses
              3 views
              0 likes
              Last Post The_Sec
              by The_Sec
               
              Started by GwFutures1988, Today, 02:48 PM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Working...
              X