TOptValue_number
What Is It?
TOptValue_number
is a class used to define numeric parameters for custom indicators.
These parameters appear in the indicator settings panel and allow the user to input or adjust numbers such as periods, shifts, price types, and more.
You must use the createTOptValue_number()
method of the api
object inside Init()
method to create an instance.
When to Use
Use TOptValue_number
when you need a configurable parameter of type number
, such as:
Period length for moving averages
Shift values
Enum values (e.g., MA type, price type)
Any numeric input from the user
Syntax
Example
In this example:
Period
controls how many bars are used in the moving average calculation.Shift
can offset the indicator horizontally.MAtype
selects the type of moving average (e.g., SMA, EMA).ApplyToPrice
defines which price (close, open, high, low) the MA should use.VShift
applies a vertical offset to the line.
Notes
You can access the value using
this.MyParameter.value
.
Last updated