Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to create non-selectable readonly property grid element?

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

    How to create non-selectable readonly property grid element?

    Hello.

    I need readonly parameter for strategy.

    I did it in this way:

    PHP Code:
    [ReadOnly(true)] 
    [
    Range(1int.MaxValue), NinjaScriptProperty]
    [
    GroupName "Periods"Order 1)]    
    public  
    int Period1     getset; } 
    It works correct in StartegyAnalyzer but, property still changeable when Strategies dialogue when applying strategy on chart.

    How to make property unchangeable (but visible) everywhere?
    Last edited by fx.practic; 06-21-2018, 12:59 PM.
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    #2
    Hello fx.practic,

    Thanks for your post.

    I would not expect the property grid behavior to be different for strategies applied to a chart vs. indicators. I am also seeing that indicators can use the ReadOnly attribute without issue in a chart, but we see the difference in behavior with strategies.

    I'm looking into this further and will keep this thread informed as this develops.

    In the meantime, I would recommend making a property private if you do not want it to be modifiable.

    Thanks for your patience while we look into the ReadOnly attribute further.
    JimNinjaTrader Customer Service

    Comment


      #3
      Ok, thank You. Will be waiting and monitoring this thread.
      fx.practic
      NinjaTrader Ecosystem Vendor - fx.practic

      Comment


        #4
        Originally posted by fx.practic View Post
        Hello.

        I need readonly parameter for strategy.

        I did it in this way:

        PHP Code:
        [ReadOnly(true)] 
        [
        Range(1int.MaxValue), NinjaScriptProperty]
        [
        GroupName "Periods"Order 1)]    
        public  
        int Period1     getset; } 
        It works correct in StartegyAnalyzer but, property still changeable when Strategies dialogue when applying strategy on chart.

        How to make property unchangeable (but visible) everywhere?
        Remove the setter from the property definition?

        Comment


          #5
          Thanks for the hint koganam.

          To touch on this more, the setter for the property does appear to be disabled, and the property is "read only" when the attribute is used directly, but the property's control is still "modifiable" even though the value gets reverted. This could be permissible to some, but this shows a bigger issue when using a TypeConverter to modify the property grid behavior as we seen in the example here.

          The setter cannot simply be removed without more modifications, but you could use a backing field property (like we see in NinjaTrader 7 properties) to achieve read only behavior. However, this would ultimately still provide the same behavior witnessed at the current moment.

          I've reported the matter internally, and I'll update this thread with more details as they come.
          JimNinjaTrader Customer Service

          Comment


            #6
            koganam, thank You for idea.

            If just to remove setter - code not compiled.

            I made parameters in .Net 3.5 style.
            They looks in another way, but values unchangeable as I need.
            fx.practic
            NinjaTrader Ecosystem Vendor - fx.practic

            Comment


              #7
              Thank You, Jim.
              fx.practic
              NinjaTrader Ecosystem Vendor - fx.practic

              Comment


                #8
                Originally posted by fx.practic View Post
                koganam, thank You for idea.

                If just to remove setter - code not compiled.

                I made parameters in .Net 3.5 style.
                They looks in another way, but values unchangeable as I need.
                Hm. Strange. As that is the documented Microsoft method.

                ref: https://docs.microsoft.com/en-us/dot...ted-properties.

                But yes, using regular properties is a very viable way to do things.

                Comment


                  #9
                  Hello fx.practic,

                  The issue reported has been confirmed as a bug and has been given the ticket ID NTEIGHT-12976. The number for this ID will be noted in the Release Notes page of the help guide when a new version of NinjaTrader gets released including a fix for this issue.

                  Release Notes - https://ninjatrader.com/support/help...ease_notes.htm

                  Please let us know if we can be of further assistance.
                  JimNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Virgil123, Today, 01:39 PM
                  0 responses
                  4 views
                  0 likes
                  Last Post Virgil123  
                  Started by kawalecld, Today, 12:21 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post kawalecld  
                  Started by exjayess, Today, 11:04 AM
                  1 response
                  12 views
                  0 likes
                  Last Post NinjaTrader_ShawnB  
                  Started by robertlaub, Today, 11:11 AM
                  2 responses
                  7 views
                  0 likes
                  Last Post robertlaub  
                  Started by sdauteuil, Today, 10:28 AM
                  0 responses
                  7 views
                  0 likes
                  Last Post sdauteuil  
                  Working...
                  X