SetOptionRange
Sets the valid range for a numeric option.
Syntax
SetOptionRange(name: string, lowValue: number, highValue: number): void
Parameters
name
- A string containing the name of the option to set the range for.lowValue
- A number representing the minimum allowed value.highValue
- A number representing the maximum allowed value.
Return Value
This method does not return a value.
Description
The SetOptionRange
method sets the valid range for a numeric option. This is used to define the minimum and maximum values that users can input for a numeric option in an indicator or strategy.
Example
// Register a period option
this.api.RegOption("Period", TOptionType.INTEGER, 14);
// Set the valid range for the period option (1 to 200)
this.api.SetOptionRange("Period", 1, 200);
// Register a level option
this.api.RegOption("Overbought Level", TOptionType.DOUBLE, 70);
// Set the valid range for the level option (50 to 100)
this.api.SetOptionRange("Overbought Level", 50, 100);
Last updated