• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Parameters "read only"

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

    Parameters "read only"

    Hello,

    I need to set a "read only" parameter in my strategy ("version" for example), so the user can view it but he can't change it. How can I declare a read only parameter?

    Thnaks and regards.

    #2
    Hello soyjesus,

    Thanks for your post.

    You can add the ReadOnly attribute to your property to accomplish this.

    For example:

    Code:
    [Description("")]
    [GridCategory("Parameters")]
    [ReadOnly(true)] 
    public int MyInput
    {
        get { return myInput; }
        set { myInput = Math.Max(1, value); }
    }
    Please let us know if we can be of further assistance.
    JimNinjaTrader Customer Service

    Comment


      #3
      Originally posted by soyjesus View Post
      Hello,

      I need to set a "read only" parameter in my strategy ("version" for example), so the user can view it but he can't change it. How can I declare a read only parameter?

      Thnaks and regards.
      Or delete the setter on the property.

      Comment


        #4
        Originally posted by soyjesus View Post
        Hello,

        I need to set a "read only" parameter in my strategy ("version" for example), so the user can view it but he can't change it. How can I declare a read only parameter?

        Thnaks and regards.
        Code:
                private const string productVersion = "1.0.0.0";
        
                [XmlIgnore()]
                [GridCategory("Parameters")]
                public string ProductVersion
                {
                    get { return productVersion; }
                    set { ; }
                }

        Comment


          #5
          Sounds like you need a read-only property ... which is not the same thing as a read-only variable.

          Define the variable any way you want, ie, just define it normally, or make it const.

          Then make the property read-only using one of the techniques described above.

          Comment


            #6
            Originally posted by DEEPIKALI

            I need to set a "read only" parameter in my strategy ("version" for example), so the user can view it but he can't change it. How can I declare a read only parameter?
            Same answer. Any of the above on the property will do that for you.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by manueldecastro, Today, 12:57 AM
            0 responses
            5 views
            0 likes
            Last Post manueldecastro  
            Started by JulieG, Today, 12:40 AM
            0 responses
            5 views
            0 likes
            Last Post JulieG
            by JulieG
             
            Started by jimjoe123, Yesterday, 09:28 PM
            2 responses
            12 views
            0 likes
            Last Post NinjaTrader_ChrisSch  
            Started by 12VMan, 08-20-2019, 09:29 AM
            2 responses
            25 views
            0 likes
            Last Post Lancer
            by Lancer
             
            Started by tgn55, Yesterday, 09:50 PM
            0 responses
            5 views
            0 likes
            Last Post tgn55
            by tgn55
             
            Working...
            X