Skip to content
ChartDeck ChartScript docs Account Open the terminal

input

A setting; its type follows defval (a source such as close makes a source select).

#Functions

#inputfunction

A setting; its type follows defval (a source such as close makes a source select).

input(defval: const T, { title?: const string = "", tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): T
ParameterTypeDescription
defvalconst TThe default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input T.

Example

ChartScriptFragmentOpen in editor
const len = input(14, "Length")

Since ChartScript 1

#input.boolfunction

An on/off setting.

input.bool(defval: const bool, { title?: const string = "", tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): bool
ParameterTypeDescription
defvalconst boolThe default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input bool.

Example

ChartScriptFragmentOpen in editor
const show = input.bool(true, "Show bands")

Since ChartScript 1

#input.colorfunction

A color setting: a swatch on the Inputs tab (in its section) or, without sections or tabs, on the Style tab, and always on the Colors tab, where the color presets use its role.

input.color(defval: const color, { title?: const string = "", tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false, role?: const string = "" }): color
ParameterTypeDescription
defvalconst colorThe default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under (also its section on the Colors tab).
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "style" (default for a color) or "inputs".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.
roleconst stringdefault ""What the color means, for the color presets of the Colors tab (Colorblind-safe, Monochrome, High contrast): "up" (bullish, buy, support), "down" (bearish, sell, resistance), "neutral" (greys, text, grids, guides) or "accent" (any other line). Empty = guessed from the theme color, the title ("Bull", "Support" ...) and the hue. Another value is error CS2014. Plots, shapes, levels, fills and style.* objects take the same role.

Returns input color.

Example

ChartScriptFragmentOpen in editor
settings.section("trend", "Trend")
const upColor = input.color(color.up, "Rising", { role: "up" })
const downColor = input.color(color.down, "Falling", { role: "down" })
plot(close, "Close", close >= open ? upColor : downColor)

Since ChartScript 1

#input.durationfunction

A length of time ("4h", "30m", "2d", "1w" or "120b" for bars) given to the script as bars at the chart timeframe (at least 1).

input.duration({ defval?: const string = "1h", title?: const string = "", tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): int
ParameterTypeDescription
defvalconst stringdefault "1h"The default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input int.

Example

ChartScriptFragmentOpen in editor
const n = input.duration("4h", "Lookback")

Since ChartScript 1

#input.enumfunction

A select of the items of an enum (their titles are shown).

input.enum(defval: const T, { title?: const string = "", options?: const tuple<T> = na, tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): T
ParameterTypeDescription
defvalconst TThe default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
optionsconst tuple<T>default naThe values to choose from.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input T.

Example

ChartScriptFragmentOpen in editor
enum Side {
    long = "Long",
    short = "Short"
}
const side = input.enum(Side.long, "Side")

Since ChartScript 1

#input.floatfunction

A number setting.

input.float(defval: simple float, { title?: const string = "", minval?: const float = na, maxval?: const float = na, step?: const float = na, options?: const tuple<float> = na, tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): float
ParameterTypeDescription
defvalsimple floatThe default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
minvalconst floatdefault naThe smallest value allowed.
maxvalconst floatdefault naThe largest value allowed.
stepconst floatdefault naThe step of the arrows.
optionsconst tuple<float>default naThe values to choose from.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input float.

Example

ChartScriptFragmentOpen in editor
const mult = input.float(2.0, "Multiplier", { step: 0.1 })

Since ChartScript 1

#input.fontfunction

A font setting (the fonts the terminal ships).

input.font({ defval?: const string = font.ui, title?: const string = "", tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): string
ParameterTypeDescription
defvalconst stringdefault font.uiThe default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input string.

Example

ChartScriptFragmentOpen in editor
const f = input.font(font.mono, "Font")

Since ChartScript 1

#input.gradientfunction

A gradient setting (a stop editor).

input.gradient(defval: const string, { title?: const string = "", tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): string
ParameterTypeDescription
defvalconst stringThe default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input string.

Example

ChartScriptFragmentOpen in editor
const g = input.gradient(gradient.new(color.blue, color.red), "Heat")

Since ChartScript 1

#input.intfunction

A whole-number setting.

input.int(defval: simple int, { title?: const string = "", minval?: const int = na, maxval?: const int = na, step?: const int = 1, options?: const tuple<int> = na, tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): int
ParameterTypeDescription
defvalsimple intThe default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
minvalconst intdefault naThe smallest value allowed.
maxvalconst intdefault naThe largest value allowed.
stepconst intdefault 1The step of the arrows.
optionsconst tuple<int>default naThe values to choose from.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input int.

Example

ChartScriptFragmentOpen in editor
const len = input.int(14, "Length", { minval: 1 })

Since ChartScript 1

#input.linestylefunction

A line style setting: solid, dashed, dotted, dash-dot, long dash or a custom dash.

input.linestyle({ defval?: const string = dash.solid, title?: const string = "", tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): string
ParameterTypeDescription
defvalconst stringdefault dash.solidThe default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input string.

Example

ChartScriptFragmentOpen in editor
const ls = input.linestyle(dash.dotted, "Line style")

Since ChartScript 1

#input.listfunction

Several choices at once (chips): an array of the chosen options, in the options' order.

input.list(defval: const tuple<string>, { title?: const string = "", options?: const tuple<string> = na, max_items?: const int = na, tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): array<string>
ParameterTypeDescription
defvalconst tuple<string>The default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
optionsconst tuple<string>default naThe values to choose from.
max_itemsconst intdefault naThe max items.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input array<string>.

Example

ChartScriptFragmentOpen in editor
const coins = input.list(["BTC", "ETH"], "Coins", { options: ["BTC", "ETH", "SOL"] })

Since ChartScript 1

#input.ma_typefunction

A moving-average type setting (the 11 ChartDeck types; ChartDeck extra).

input.ma_type(defval: const string, { title?: const string = "", tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): string
ParameterTypeDescription
defvalconst stringThe default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input string.

Example

ChartScriptFragmentOpen in editor
const maType = input.ma_type("ema", "MA type")

Since ChartScript 1

#input.marketfunction

A market setting (VENUE:SYMBOL, the market search).

input.market(defval: const string, { title?: const string = "", tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): string
ParameterTypeDescription
defvalconst stringThe default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input string.

Example

ChartScriptFragmentOpen in editor
const mkt = input.market("BINANCE:BTCUSDT", "Compare with")

Since ChartScript 1

#input.palettefunction

A palette setting: the member picks one of the palettes and may edit its colours.

input.palette(defval: const string, { title?: const string = "", palettes?: const tuple<string> = na, tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): string
ParameterTypeDescription
defvalconst stringThe default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
palettesconst tuple<string>default naThe palettes.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input string.

Example

ChartScriptFragmentOpen in editor
const pro = palette.new("Pro", { bull: #26A69A, bear: #EF5350 })
const p = input.palette(pro, "Palette")

Since ChartScript 1

#input.positionfunction

A position setting (a 3 x 3 picker).

input.position({ defval?: const string = position.top_right, title?: const string = "", tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): string
ParameterTypeDescription
defvalconst stringdefault position.top_rightThe default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input string.

Example

ChartScriptFragmentOpen in editor
const pos = input.position(position.bottom_right, "Corner")

Since ChartScript 1

#input.pricefunction

A price setting.

input.price(defval: const float, { title?: const string = "", tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): float
ParameterTypeDescription
defvalconst floatThe default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input float.

Example

ChartScriptFragmentOpen in editor
const level = input.price(100.0, "Level")

Since ChartScript 1

#input.rangefunction

A low / high pair (a two-thumb slider); low ≤ high always holds.

input.range(lo: const float, hi: const float, { title?: const string = "", minval?: const float = na, maxval?: const float = na, step?: const float = na, tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): tuple<float,float>
ParameterTypeDescription
loconst floatThe lo.
hiconst floatThe hi.
titleconst stringdefault ""The name shown in the settings, legend and data window.
minvalconst floatdefault naThe smallest value allowed.
maxvalconst floatdefault naThe largest value allowed.
stepconst floatdefault naThe step of the arrows.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input tuple<float,float>.

Example

ChartScriptFragmentOpen in editor
const [lo, hi] = input.range(20, 80, "Band", { minval: 0, maxval: 100 })

Since ChartScript 1

#input.sessionfunction

A session setting ("HHMM-HHMM", UTC).

input.session(defval: const string, { title?: const string = "", options?: const tuple<string> = na, tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): string
ParameterTypeDescription
defvalconst stringThe default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
optionsconst tuple<string>default naThe values to choose from.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input string.

Example

ChartScriptFragmentOpen in editor
const sess = input.session("0930-1600", "Session")

Since ChartScript 1

#input.shapefunction

A shape setting (an icon grid).

input.shape({ defval?: const string = shape.circle, title?: const string = "", tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): shape_style
ParameterTypeDescription
defvalconst stringdefault shape.circleThe default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input shape_style.

Example

ChartScriptFragmentOpen in editor
const sh = input.shape(shape.triangleup, "Marker")

Since ChartScript 1

#input.sizefunction

A text size setting: pixels, points or relative, with the named sizes as chips.

input.size({ defval?: const string = size.normal, title?: const string = "", minval?: const float = na, maxval?: const float = na, tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): size
ParameterTypeDescription
defvalconst stringdefault size.normalThe default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
minvalconst floatdefault naThe smallest value allowed.
maxvalconst floatdefault naThe largest value allowed.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input size.

Example

ChartScriptFragmentOpen in editor
const sz = input.size(size.pt(9), "Label size")

Since ChartScript 1

#input.sourcefunction

A price-source setting (close, open, high, low, volume, hl2, hlc3, ohlc4, hlcc4).

input.source(defval: float, { title?: const string = "", tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): float
ParameterTypeDescription
defvalfloatThe default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns float.

Example

ChartScriptFragmentOpen in editor
const src = input.source(close, "Source")

Since ChartScript 1

#input.stringfunction

A text setting (a select with options).

input.string(defval: const string, { title?: const string = "", options?: const tuple<string> = na, tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): string
ParameterTypeDescription
defvalconst stringThe default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
optionsconst tuple<string>default naThe values to choose from.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input string.

Example

ChartScriptFragmentOpen in editor
const mode = input.string("Fast", "Mode", { options: ["Fast", "Slow"] })

Since ChartScript 1

#input.text_areafunction

A multi-line text setting (up to 2,000 characters).

input.text_area(defval: const string, { title?: const string = "", tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): string
ParameterTypeDescription
defvalconst stringThe default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input string.

Example

ChartScriptFragmentOpen in editor
const note = input.text_area("", "Notes")

Since ChartScript 1

#input.textstylefunction

A text style setting: size, font, weight, italic, colour, halo and background in one row.

input.textstyle({ defval?: const string = "", title?: const string = "", tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): string
ParameterTypeDescription
defvalconst stringdefault ""The default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input string.

Example

ChartScriptFragmentOpen in editor
const ts = input.textstyle(textstyle.new(size.pt(9), font.ui, 600), "Labels")

Since ChartScript 1

#input.timefunction

A time setting (ms, UTC).

input.time(defval: const int, { title?: const string = "", tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): int
ParameterTypeDescription
defvalconst intThe default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input int.

Example

ChartScriptFragmentOpen in editor
const from = input.time(timestamp(2024, 1, 1), "From")

Since ChartScript 1

#input.timeframefunction

A timeframe setting.

input.timeframe(defval: const string, { title?: const string = "", options?: const tuple<string> = na, tooltip?: const string = "", inline?: const string = "", group?: const string = "", display?: const display = display.all, confirm?: const bool = false, tab?: const string = "inputs", visible_if?: simple bool = true, enabled_if?: simple bool = true, validate?: simple bool = true, validate_msg?: const string = "", severity?: const string = "error", unit?: const string = "", widget?: const string = "", snap?: const bool = true, section?: const string = "", row?: const string = "", advanced?: const bool = false, placeholder?: const string = "", required?: const bool = false }): string
ParameterTypeDescription
defvalconst stringThe default value.
titleconst stringdefault ""The name shown in the settings, legend and data window.
optionsconst tuple<string>default naThe values to choose from.
tooltipconst stringdefault ""Help text shown next to the input.
inlineconst stringdefault ""Inputs with the same inline text share one row.
groupconst stringdefault ""The section heading the input is listed under.
displayconst displaydefault display.allWhere the value is shown (display.*).
confirmconst booldefault falseAccepted and ignored.
tabconst stringdefault "inputs"The settings tab: "inputs" or "style".
visible_ifsimple booldefault trueShow the input only while this condition (of other inputs, the chart timeframe or the market kind) is true; a hidden input keeps its value.
enabled_ifsimple booldefault trueGrey the input out while this condition is false (the panel says why).
validatesimple booldefault trueA check of the value (and other inputs) shown under the input while the user types.
validate_msgconst stringdefault ""The message shown when validate is false.
severityconst stringdefault "error""error": OK is disabled while the check fails; "warning": a note only.
unitconst stringdefault ""The unit shown beside the field (unit.*).
widgetconst stringdefault ""How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches).
snapconst booldefault trueRound to step.
sectionconst stringdefault ""The id of a settings.section to place the input in.
rowconst stringdefault ""The id of a settings.row to place the input in.
advancedconst booldefault falseList the input under its section's Advanced disclosure.
placeholderconst stringdefault ""Grey text shown in an empty text field.
requiredconst booldefault falseA text input that may not be left empty.

Returns input string.

Example

ChartScriptFragmentOpen in editor
const tf = input.timeframe("1D", "Higher timeframe")

Since ChartScript 1

#Not supported

#input.symbolfunction

Not supported in ChartScript.

Not supported: use input.market.

Since ChartScript 1

The ChartScript documentation is in English for now; translations will follow.