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

Property Grids - Expandable Objects & BarsPeriod

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

    Property Grids - Expandable Objects & BarsPeriod

    Hey there,

    I have a couple of questions about Property lists I hope someone can help with.

    Firstly, I'm using the ExpandableObjectConverter TypeConverter to display my properties; however when the properties dialog first opens all of my settings are collapsed. I can't figure out how to make it open fully expanded; is there a way to achieve this?

    Secondly, while investigating how to expand the property grid by default. I looked at this indicator:


    It doesn't do what I need, but it presents the BarsPeriod on the property grid which is useful for setting up multi-timeframe indicators. I can't figure out how this is being done; the sample code makes no reference of a BarsPeriod. And if I reference a BarsPeriod object directly, I get loads of properties I don't require.
    Attached Files

    #2
    Hello,

    Thank you for the post.

    Regarding expanding the properties automatically, I am unaware on anyway to do this for expandable objects. I will put in a question to development to see if there are any ways for attributes or another syntax to expand them.

    For the BarsPeriod selector, you could use the following code. It appears the image you provided is no longer the same as the file that was linked. It may have been updated at some point after you downloaded it is why you cannot find that property:


    Code:
    [NinjaScriptProperty]
    [TypeConverter(typeof(BarsPeriodConverter))]
    [Display(Name="Select BarsPeriod", GroupName = "Parameters", Order = 0)]
    public BarsPeriod BarsPeriodInput
    { get; set; }
    For this to appear, you would need to first assign a value because this can be null:

    Code:
    if (State == State.SetDefaults)
    {
    	BarsPeriodInput = new BarsPeriod();

    i look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Expandable property reverting back to default values after recompiling

      Attached is a sample for defining exandable properties via a custom class.

      Basically it works well as it will correctly serialize the public properties of the custom class such that they can be saved being part of a chart template or workspace.

      The only problem here is that the porperties of the custom class will revert bac to default values on an open chart, when NinjaTrader recompiles.

      We had this same issue with enums (see #ID 11504), which was then fixed with the release NT 8.0.7.0.

      How would I avoid that the properties revert back to the default values after a recompile?
      Attached Files

      Comment


        #4
        I get around this by setting the persisted property with the ReadOnly attribute rather than Browsable(false) this unfortunately displays the serialized string in the property grid, but gets around the problem of settings reverting on rebuild.

        Details here:

        Last edited by reach4thelasers; 07-17-2017, 03:22 PM.

        Comment


          #5
          Any idea why the parameters of a subclass revert back to default parameters when NinjaTrader compiles?

          I have also looked at the sample provided by JessicaP here, and it does not work either.



          I have used this approach in a number of indicators and they currently do not keep their indicator settings, when NinjaTrader compiles.

          Comment


            #6
            NT7 was the same way.
            eDanny
            NinjaTrader Ecosystem Vendor - Integrity Traders

            Comment


              #7
              Originally posted by eDanny View Post
              NT7 was the same way.
              Did you find a solution to the problem?

              Comment


                #8
                Unfortunately not.
                eDanny
                NinjaTrader Ecosystem Vendor - Integrity Traders

                Comment


                  #9
                  I've run into this same problem. I can also confirm that the NT-provided expanded class example has this issue as well. The values revert to default on recompile.

                  Anyone able to shed new light on this issue?

                  Comment


                    #10
                    There has been no progress with this issue. There is another thread were we had discussed it, but the sample provided so far do not work.

                    Maybe you could support me in obtaining a solution for this case.

                    Comment


                      #11
                      This is an old post but if you are still having issues with the values reverting on compile, I believe I can post a sample of how to fix it. I am currently working through some issues with this and restoring from serialized versions but I believe I have enough to point you in the right direction. The code may be a bit more clunky than it needs to be since, as I stated, I'm still working through it.

                      If you do want a sample, provide the exact details of what you are trying to achieve. I'm building a more general structure so I may need to tailor to suit your needs.

                      Wil

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by swestendorf, Today, 11:14 AM
                      2 responses
                      5 views
                      0 likes
                      Last Post NinjaTrader_Kimberly  
                      Started by xiinteractive, 04-09-2024, 08:08 AM
                      4 responses
                      13 views
                      0 likes
                      Last Post xiinteractive  
                      Started by Mupulen, Today, 11:26 AM
                      0 responses
                      2 views
                      0 likes
                      Last Post Mupulen
                      by Mupulen
                       
                      Started by Sparkyboy, Today, 10:57 AM
                      1 response
                      5 views
                      0 likes
                      Last Post NinjaTrader_Jesse  
                      Started by TheMarlin801, 10-13-2020, 01:40 AM
                      21 responses
                      3,917 views
                      0 likes
                      Last Post Bidder
                      by Bidder
                       
                      Working...
                      X