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

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 yertle, Yesterday, 08:38 AM
                  7 responses
                  28 views
                  0 likes
                  Last Post yertle
                  by yertle
                   
                  Started by bmartz, 03-12-2024, 06:12 AM
                  2 responses
                  20 views
                  0 likes
                  Last Post bmartz
                  by bmartz
                   
                  Started by funk10101, Today, 12:02 AM
                  0 responses
                  4 views
                  0 likes
                  Last Post funk10101  
                  Started by gravdigaz6, Yesterday, 11:40 PM
                  1 response
                  8 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by MarianApalaghiei, Yesterday, 10:49 PM
                  3 responses
                  10 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Working...
                  X