Functions
input()
This function lets script users customize settings by adding an input field to the script's Settings tab. The input type is automatically determined based on the default value you provide.
Syntax · 1 of 6
input(const color defval, const string title, const string tooltip, const string inline, const string group, const bool confirm) → input color
Arguments
defval required const color 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. tooltip const string The string that will be shown to the user when hovering over the tooltip icon. inline const string Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line. group const string Creates a header above all inputs using the same group argument string. The string is also used as the header's text. confirm const bool Return Type
input color Syntax · 2 of 6
input(const string defval, const string title, const string tooltip, const string inline, const string group, const bool confirm) → input string
Arguments
defval required 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. 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. tooltip const string The string that will be shown to the user when hovering over the tooltip icon. inline const string Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line. group const string Creates a header above all inputs using the same group argument string. The string is also used as the header's text. confirm const bool Return Type
input string Syntax · 3 of 6
input(const int defval, const string title, const string tooltip, const string inline, const string group, const bool confirm) → input int
Arguments
defval required 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. 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. tooltip const string The string that will be shown to the user when hovering over the tooltip icon. inline const string Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line. group const string Creates a header above all inputs using the same group argument string. The string is also used as the header's text. confirm const bool Return Type
input int Syntax · 4 of 6
input(const float defval, const string title, const string tooltip, const string inline, const string group, const bool confirm) → input float
Arguments
defval required const float 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. tooltip const string The string that will be shown to the user when hovering over the tooltip icon. inline const string Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line. group const string Creates a header above all inputs using the same group argument string. The string is also used as the header's text. confirm const bool Return Type
input float Syntax · 5 of 6
input(series float defval, const string title, const string tooltip, const string inline, const string group, const bool confirm) → series float
Arguments
defval required series float 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. tooltip const string The string that will be shown to the user when hovering over the tooltip icon. inline const string Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line. group const string Creates a header above all inputs using the same group argument string. The string is also used as the header's text. confirm const bool Return Type
series float Syntax · 6 of 6
input(const bool defval, const string title, const string tooltip, const string inline, const string group, const bool confirm) → input bool
Arguments
defval required const bool 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. tooltip const string The string that will be shown to the user when hovering over the tooltip icon. inline const string Combines all the input calls using the same argument in one line. The string used as an argument is not displayed. It is only used to identify inputs belonging to the same line. group const string Creates a header above all inputs using the same group argument string. The string is also used as the header's text. confirm const bool Return Type
input bool Example
indicator("Customizable Moving Average", overlay=true)
length = input(14, title="SMA Length")
sma_value = talib.sma(close, length)
plot(sma_value, title="SMA", color=color.blue, linewidth=2)