Input
input
input
Definition: Adds an input to the Inputs tab of your script's Settings, which allows you to provide configuration options to script users. This function automatically detects the type of the argument used for 'defval' and uses the corresponding input widget.
Syntax:
Returns:
Arguments:
defval
(const int/float/bool or source-type built-ins)
Determines the default value of the input variable proposed in the script's "Settings/Inputs" tab, from where script users can change it. Source-type built-ins are built-in series float variables that specify the source of the calculation: close
, hlc3
, etc.
title
const string
Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.
Example:
input.source
input.source
Definition: 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 dropdown that allows the user to select a source for the calculation, e.g. close, hl2, etc. The user can also select an output from another indicator on their chart as the source.
Syntax:
Returns:
Arguments:
defval
(open/high/low/close/hl2/hlc3/ohlc4/hlcc4)
Determines the default value of the input variable proposed in the script's "Settings/Inputs" tab, from where the user can change it.
title
const string
Title of the input. If not specified, the variable name is used as the input's title. If the title is specified, but it is empty, the name will be an empty string.
Example:
Remarks: Result of input.source function always should be assigned to a variable, see examples above.
input.float
input.float
input.float
is used to add an input to the Inputs tab of your script's Settings, which provides configuration options to script users. This function adds a field for a float input to the script's inputs.
Syntax:
Returns:
Arguments:
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.
title
const string
Title of the input.
minval
const int/float
Minimal possible value of the input variable. Optional.
maxval
const int/float
Maximum possible value of the input variable. Optional.
step
const int/float
Step value used for incrementing/decrementing the input. Optional. The default is 1.
Example:
input.int
input.int
input.int
is used to add an input to the Inputs tab of your script's Settings, which provides configuration options to script users. This function adds a field for an integer input to the script's inputs.
Syntax:
Returns:
Arguments:
defval
const int
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.
title
const string
Title of the input.
minval
const int
Minimal possible value of the input variable. Optional.
maxval
const int
Maximum possible value of the input variable. Optional.
step
const int
Step value used for incrementing/decrementing the input. Optional. The default is 1.
Example:
input.session
input.session
input.session
is used to add an input to the Inputs tab of your script's Settings, which provides configuration options to script users. This function adds two dropdowns that allow the user to specify the beginning and end of a session.
Syntax:
Returns:
Arguments:
defval
const string
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.
title
const string
Title of the input.
Example:
input.bool
input.bool
Definition: 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 checkmark to the script's inputs.
Syntax:
Returns:
Arguments:
defval
const bool
Determines the default value of the input variable proposed in the script's "Settings/Inputs" tab, from where the user can change it.
title
const string
Title of the input.
Example:
Last updated