Skip to main content
Language version: 2 · Reference version: 2.7 · Date: 2026-10-25 · Compiler build: df7b3b14 · Namespace: input · Entries: 15

input (library)

Definition Twelve functions, one per kind of setting the reader can change from the chart: bool, colour, enum, float, int, price, session, source, string, text area, time and timeframe. A value that came from one of these carries the input form — you never write that qualifier, the call produces it. Example

input.bool (function)

Definition Offers the reader a true-or-false setting and hands back what they chose. One of twelve input functions, one per kind of control. Only defval is required. Syntax
Parameters Returns input bool Notes
  • The default defval must be a value: na is rejected with “Argument defval of input.bool() cannot be na.” Any constant expression of type bool is accepted, such as true.
Example

input.color (function)

Definition Asks the reader for a colour. Pass the result straight to a colour argument of a chart-output call; those arguments accept an input-form colour. Syntax
Parameters Returns input color Notes
  • The default defval must be a value: na is rejected with “Argument defval of input.color() cannot be na.” Any constant expression of type color is accepted, such as color.red or color.new(color.red, 0.5).
Example

input.enum (function)

Definition Adds a dropdown setting whose choices are the members of an enum you declare. It returns the chosen member, so the script can compare it with the members directly. Each member’s title, the text after = in the enum declaration, is what the reader sees in the dropdown. options can limit the dropdown to some of the members. Syntax
Parameters Returns input enum Example

input.float (function, overload 1)

Definition The decimal counterpart of input.int, with the same arguments and const float in place of const int. minval, maxval and step may each be given by name, as in input.float(2.0, "Mult", step=0.5). Syntax
Parameters Returns input float Notes
  • The default defval must be a value: na is rejected with “Argument defval of input.float() cannot be na.” Any constant expression of type float is accepted, such as -5.5 or 2.5 * 2.
Example

input.float (function, overload 2)

Definition The decimal counterpart of input.int, with the same arguments and const float in place of const int. minval, maxval and step may each be given by name, as in input.float(2.0, "Mult", step=0.5). Syntax
Parameters Returns input float Notes
  • The default defval must be a value: na is rejected with “Argument defval of input.float() cannot be na.” Any constant expression of type float is accepted, such as -5.5 or 2.5 * 2.
Example

input.int (function, overload 1)

Definition A whole-number setting, with optional bounds and an optional increment. It and input.float are the only two input functions that take minval, maxval and step; each may be given by name, as in input.int(14, "Length", minval=1, step=2). Syntax
Parameters Returns input int Notes
  • The default defval must be a value: na is rejected with “Argument defval of input.int() cannot be na.” Any constant expression of type int is accepted, such as -5 or 2 * 3.
Example

input.int (function, overload 2)

Definition A whole-number setting, with optional bounds and an optional increment. It and input.float are the only two input functions that take minval, maxval and step; each may be given by name, as in input.int(14, "Length", minval=1, step=2). Syntax
Parameters Returns input int Notes
  • The default defval must be a value: na is rejected with “Argument defval of input.int() cannot be na.” Any constant expression of type int is accepted, such as -5 or 2 * 3.
Example

input.price (function)

Definition A price setting. The value comes back as a float. Unlike input.float it takes no bounds and no step, so use input.float where a range matters. Syntax
Parameters Returns input float Notes
  • The default defval must be a value: na is rejected with “Argument defval of input.price() cannot be na.” Any constant expression of type float is accepted, such as 100.5 or 2.5 * 2.
Example

input.session (function)

Definition Asks the reader for a session and gives you back a string. The string is a session in the form that time() reads: HHMM-HHMM on a 24-hour clock, such as “0930-1600”. Join ranges with commas, as in “1000-1100,1400-1500”. Add : and the digits 1 to 7 to limit the session to days, Sunday being 1, as in “0930-1600:23456”. A range that ends before it starts wraps past midnight, and “0000-0000” is the whole day. Syntax
Parameters Returns input string Example

input.source (function)

Definition Lets the reader pick which series the script reads — the close, the high, a midpoint, and so on. It is the exception in this namespace: it returns a series float rather than an input-form value, so what you get back can differ on every bar. Syntax
Parameters Returns series float Example

input.string (function)

Definition A one-line text setting. For a longer piece of text, reach for input.text_area instead; both return an input string. Syntax
Parameters Returns input string Notes
  • The default defval must be a value: na is rejected with “Argument defval of input.string() cannot be na.” Any constant expression of type string is accepted, such as "a" + "b".
Example

input.text_area (function)

Definition A multi-line text setting, for a message or a note rather than a single word. Syntax
Parameters Returns input string Example

input.time (function)

Definition A time setting, returned as an int. The date functions take a time and a timezone, so a value from here can be fed to hour, year and the rest. Syntax
Parameters Returns input int Notes
  • The default defval must be a value: na is rejected with “Argument defval of input.time() cannot be na.” Any constant expression of type int that gives a time in milliseconds is accepted, such as 1700000000000 or 1000 * 60 * 60.
Example

input.timeframe (function)

Definition Asks the reader for a timeframe. The answer arrives as a string. Note what it is not: choosing a timeframe here does not fetch that timeframe’s data. Lipi has no way to request another symbol’s or another interval’s series. Syntax
Parameters Returns input string Example