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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      181 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      334 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      258 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      358 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      187 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X