Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Setting Parameter to 0

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

    Setting Parameter to 0

    I am using the standard get/set on my indicator parameters. I have an "int" that I want the user to be able to set to 0. However, when I type in 0 in the parameter window, it immediately gets changes to 1.

    Any ideas?

    Thanks.

    #2
    Hello,

    Thank you for the question.

    This is caused in your public property.
    I will post an example below, you need to change the Range of the Minimum value

    Code:
    #region Properties
    
    [Description("Numbers of bars used for calculations")]
    [GridCategory("Parameters")]
    public int Period
    {
    	get { return period; }
    	[B]set { period = Math.Max(1, value); }[/B]
    }
    #endregion
    Where you see the 1, value. you would need to either change the 1 to a 0, or remove the Math.Max() and replace it with just value. The second option will allow the user to enter anything though so this may cause the script to error if you did not plan for that.

    Please let me know if i may be of additional assistance.

    Comment


      #3
      I set max to (0, value) and that did the trick. Perfect!

      Thanks.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by sjsj2732, 03-23-2026, 04:31 AM
      0 responses
      48 views
      0 likes
      Last Post sjsj2732  
      Started by NullPointStrategies, 03-13-2026, 05:17 AM
      0 responses
      298 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      293 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      135 views
      1 like
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      98 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Working...
      X