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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      581 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      338 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      103 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      554 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      552 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X