Skip to content
Algo Trade Analytics Docs

input.int() - Pine Script Function

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 an integer input to the script’s inputs.

input.int(defval, title, options, tooltip, inline, group, confirm, display, active) → input int
NameTypeDescription
defvalconst intDetermines the default value of the input variable proposed in the script’s “Settings/Inputs” tab
fromwhere script users can change it. When a list of values is used with the options parameter
thevalue must be one of them.

Value of input variable.

  • Result of input.int function always should be assigned to a variable, see examples above.
//@version=6
indicator("input.int", overlay=true)
i_len1 = input.int(10, "Length 1", minval=5, maxval=21, step=1)
plot(ta.sma(close, i_len1))i_len2 = input.int(10, "Length 2", options=[5, 10, 21])
plot(ta.sma(close, i_len2))