Functions
input()
Declares a setting the reader can change from the chart, picking its kind from the type of the default value you hand it. Six forms exist. Give it a bool and you get a bool back; give it a colour, a float, an int or a string and the same holds. The sixth takes a series and returns a `series float`, which is how you offer a choice of chart data without naming `input.source`. There are no bounds and no step here — for those, use `input.int` or `input.float`.
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...] options, 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. options [const 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 [int...] options, 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. options [const int...] 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 [float...] options, 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. options [const float...] 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
//@lipi=2
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)