TOptValue_LineStyle
What Is It?
TOptValue_LineStyle is a class used to define line style parameters for custom indicators.
It allows users to configure line appearance (visibility, color, style, width) through the indicator settings panel.
Use the createTOptValue_LineStyle() method from the api object inside Init() method to create an instance.
When to Use
Use TOptValue_LineStyle when you want to let the user configure line appearance for:
Support/resistance levels
Trend lines
Other visual elements on charts
Syntax
public MyLineStyle!: TOptValue_LineStyle;
public Init(): void {
// Create the parameter
this.MyLineStyle = this.api.createTOptValue_LineStyle(isVisible, color, style, width, ignoreColor);
// Register the parameter
this.api.RegOption("MyLineStyle", TOptionType.LINE, this.MyLineStyle);
}Example
In this example:
LineStyleallows the user to configure line appearanceInside
Calculate(), a horizontal line is created with the configured styleThe line is positioned at the current bar's close price
Notes
Don't forget to register line style parameters using
this.RegOptioninside theInitmethod.Use
TOptionType.LINEwhen registeringTOptValue_LineStyleparameters.Access properties with
this.MyLineStyle.isVisible,this.MyLineStyle.color,this.MyLineStyle.style,this.MyLineStyle.width.
Last updated