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

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 geddyisodin, 04-25-2024, 05:20 AM
            8 responses
            59 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by jxs_xrj, 01-12-2020, 09:49 AM
            4 responses
            3,285 views
            1 like
            Last Post jgualdronc  
            Started by Option Whisperer, Today, 09:55 AM
            0 responses
            5 views
            0 likes
            Last Post Option Whisperer  
            Started by halgo_boulder, 04-20-2024, 08:44 AM
            2 responses
            22 views
            0 likes
            Last Post halgo_boulder  
            Started by mishhh, 05-25-2010, 08:54 AM
            19 responses
            6,189 views
            0 likes
            Last Post rene69851  
            Working...
            X