input.float() - Pine Script Function
input.float()
Section titled “input.float()”Overview
Section titled “Overview”Adds an input to the Inputs tab of your script’s Settings, which allows you to provide configuration options to script users. This function adds a field for a float input to the script’s inputs.
Syntax
Section titled “Syntax”input.float(defval, title, options, tooltip, inline, group, confirm, display, active) → input floatParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| defval | const int/float | Determines the default value of the input variable proposed in the script’s “Settings/Inputs” tab |
| from | — | where script users can change it. When a list of values is used with the options parameter |
| the | — | value must be one of them. |
Returns
Section titled “Returns”Value of input variable.
Remarks
Section titled “Remarks”- Result of input.float function always should be assigned to a variable, see examples above.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("input.float", overlay=true)i_angle1 = input.float(0.5, "Sin Angle", minval=-3.14, maxval=3.14, step=0.02)plot(math.sin(i_angle1) > 0 ? close : open, "sin", color=color.green)i_angle2 = input.float(0, "Cos Angle", options=[-3.14, -1.57, 0, 1.57, 3.14])plot(math.cos(i_angle2) > 0 ? close : open, "cos", color=color.red)