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| Parameter | Type | Description |
|---|---|---|
defval | const T | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input T.
Example
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| Parameter | Type | Description |
|---|---|---|
defval | const bool | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input bool.
Example
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| Parameter | Type | Description |
|---|---|---|
defval | const color | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under (also its section on the Colors tab). |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "style" (default for a color) or "inputs". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
role | const 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
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| Parameter | Type | Description |
|---|---|---|
defval | const stringdefault "1h" | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input int.
Example
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| Parameter | Type | Description |
|---|---|---|
defval | const T | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
options | const tuple<T>default na | The values to choose from. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input T.
Example
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| Parameter | Type | Description |
|---|---|---|
defval | simple float | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
minval | const floatdefault na | The smallest value allowed. |
maxval | const floatdefault na | The largest value allowed. |
step | const floatdefault na | The step of the arrows. |
options | const tuple<float>default na | The values to choose from. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input float.
Example
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| Parameter | Type | Description |
|---|---|---|
defval | const stringdefault font.ui | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input string.
Example
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| Parameter | Type | Description |
|---|---|---|
defval | const string | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input string.
Example
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| Parameter | Type | Description |
|---|---|---|
defval | simple int | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
minval | const intdefault na | The smallest value allowed. |
maxval | const intdefault na | The largest value allowed. |
step | const intdefault 1 | The step of the arrows. |
options | const tuple<int>default na | The values to choose from. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input int.
Example
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| Parameter | Type | Description |
|---|---|---|
defval | const stringdefault dash.solid | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input string.
Example
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>| Parameter | Type | Description |
|---|---|---|
defval | const tuple<string> | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
options | const tuple<string>default na | The values to choose from. |
max_items | const intdefault na | The max items. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input array<string>.
Example
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| Parameter | Type | Description |
|---|---|---|
defval | const string | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input string.
Example
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| Parameter | Type | Description |
|---|---|---|
defval | const string | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input string.
Example
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| Parameter | Type | Description |
|---|---|---|
defval | const string | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
palettes | const tuple<string>default na | The palettes. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input string.
Example
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| Parameter | Type | Description |
|---|---|---|
defval | const stringdefault position.top_right | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input string.
Example
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| Parameter | Type | Description |
|---|---|---|
defval | const float | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input float.
Example
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>| Parameter | Type | Description |
|---|---|---|
lo | const float | The lo. |
hi | const float | The hi. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
minval | const floatdefault na | The smallest value allowed. |
maxval | const floatdefault na | The largest value allowed. |
step | const floatdefault na | The step of the arrows. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input tuple<float,float>.
Example
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| Parameter | Type | Description |
|---|---|---|
defval | const string | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
options | const tuple<string>default na | The values to choose from. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input string.
Example
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| Parameter | Type | Description |
|---|---|---|
defval | const stringdefault shape.circle | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input shape_style.
Example
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| Parameter | Type | Description |
|---|---|---|
defval | const stringdefault size.normal | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
minval | const floatdefault na | The smallest value allowed. |
maxval | const floatdefault na | The largest value allowed. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input size.
Example
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| Parameter | Type | Description |
|---|---|---|
defval | float | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns float.
Example
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| Parameter | Type | Description |
|---|---|---|
defval | const string | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
options | const tuple<string>default na | The values to choose from. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input string.
Example
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| Parameter | Type | Description |
|---|---|---|
defval | const string | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input string.
Example
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| Parameter | Type | Description |
|---|---|---|
defval | const stringdefault "" | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input string.
Example
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| Parameter | Type | Description |
|---|---|---|
defval | const int | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input int.
Example
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| Parameter | Type | Description |
|---|---|---|
defval | const string | The default value. |
title | const stringdefault "" | The name shown in the settings, legend and data window. |
options | const tuple<string>default na | The values to choose from. |
tooltip | const stringdefault "" | Help text shown next to the input. |
inline | const stringdefault "" | Inputs with the same inline text share one row. |
group | const stringdefault "" | The section heading the input is listed under. |
display | const displaydefault display.all | Where the value is shown (display.*). |
confirm | const booldefault false | Accepted and ignored. |
tab | const stringdefault "inputs" | The settings tab: "inputs" or "style". |
visible_if | simple booldefault true | Show 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_if | simple booldefault true | Grey the input out while this condition is false (the panel says why). |
validate | simple booldefault true | A check of the value (and other inputs) shown under the input while the user types. |
validate_msg | const stringdefault "" | The message shown when validate is false. |
severity | const stringdefault "error" | "error": OK is disabled while the check fails; "warning": a note only. |
unit | const stringdefault "" | The unit shown beside the field (unit.*). |
widget | const stringdefault "" | How the input is shown (widget.slider, log_slider, stepper, segmented, chips, swatches). |
snap | const booldefault true | Round to step. |
section | const stringdefault "" | The id of a settings.section to place the input in. |
row | const stringdefault "" | The id of a settings.row to place the input in. |
advanced | const booldefault false | List the input under its section's Advanced disclosure. |
placeholder | const stringdefault "" | Grey text shown in an empty text field. |
required | const booldefault false | A text input that may not be left empty. |
Returns input string.
Example
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