input reference
Parameters the trader edits in the script settings.
Declare inputs at top level with input name = input.int(...) or in a grouped input ( ... ) block. Values are fixed for a run; changing one in the settings re-runs the script over the loaded history. input.group, input.section and input.tab organise long settings.
Functions
input.bool
input.bool(default: bool, title: string = "", key: string? = null, description: string? = null, sameLine: bool = false, required: bool = false, when: bool = true) -> boolAdds a true-or-false input to the script settings.
default sets the starting value. The result is never null.
titlelabels the control;keyidentifies it in saved settings.descriptionadds help text.sameLineplaces the control on the same line as the previous control.requiredmarks the control as required.whenhides the control when false.
Optional settings can be left out. The value stays fixed during each run. Changing it applies the new settings and may recalculate history.
| Parameter | Type |
|---|---|
default | bool |
title | string |
key | string? |
description | string? |
sameLine | bool |
required | bool |
when | bool |
Returns bool
Available in Setup only: declarations, setup and state initialisers.
input.color
input.color(default: color, title: string = "", key: string? = null, description: string? = null, sameLine: bool = false, required: bool = false, when: bool = true) -> colorAdds a color picker to the script settings.
default sets the starting color. The result is never null.
titlelabels the control;keyidentifies it in saved settings.descriptionadds help text.sameLineplaces the control on the same line as the previous control.requiredmarks the control as required.whenhides the control when false.
Optional settings can be left out. The value stays fixed during each run. Changing it applies the new settings and may recalculate history.
| Parameter | Type |
|---|---|
default | color |
title | string |
key | string? |
description | string? |
sameLine | bool |
required | bool |
when | bool |
Returns color
Available in Setup only: declarations, setup and state initialisers.
input.exchange
input.exchange(default: string, title: string = "", key: string? = null, description: string? = null, sameLine: bool = false, required: bool = false, filter: string[]? = null, when: bool = true) -> stringAdds a single-exchange picker to the script settings.
default sets the starting exchange ID. The result is never null.
titlelabels the control;keyidentifies it in saved settings.descriptionadds help text.sameLineplaces the control on the same line as the previous control.requiredmarks the control as required.whenhides the control when false.filterlimits the available exchanges. Null allows all exchanges.
Optional settings can be left out. The value stays fixed during each run. Changing it applies the new settings and may recalculate history.
| Parameter | Type |
|---|---|
default | string |
title | string |
key | string? |
description | string? |
sameLine | bool |
required | bool |
filter | string[]? |
when | bool |
Returns string
Available in Setup only: declarations, setup and state initialisers.
input.exchanges
input.exchanges(default: string[], title: string = "", key: string? = null, description: string? = null, sameLine: bool = false, required: bool = false, minSelected: int? = null, maxSelected: int? = null, filter: string[]? = null, when: bool = true) -> string[]Adds a multiple-exchange picker to the script settings.
default sets the starting list of exchange IDs, in order. The result array
is never null.
titlelabels the control;keyidentifies it in saved settings.descriptionadds help text.sameLineplaces the control on the same line as the previous control.requiredmarks the control as required.whenhides the control when false.filterlimits the available exchanges. Null allows all exchanges.minSelectedandmaxSelectedlimit the number of selections. Values outside their allowed bounds are rejected before the script runs.
Optional settings can be left out. The value stays fixed during each run. Changing it applies the new settings and may recalculate history.
| Parameter | Type |
|---|---|
default | string[] |
title | string |
key | string? |
description | string? |
sameLine | bool |
required | bool |
minSelected | int? |
maxSelected | int? |
filter | string[]? |
when | bool |
Returns string[]
Available in Setup only: declarations, setup and state initialisers.
input.float
input.float(default: float, title: string = "", min: float? = null, max: float? = null, key: string? = null, description: string? = null, sameLine: bool = false, required: bool = false, when: bool = true) -> floatAdds a decimal-number input to the script settings.
default sets the starting value. The result is never null.
titlelabels the control;keyidentifies it in saved settings.descriptionadds help text.sameLineplaces the control on the same line as the previous control.requiredmarks the control as required.whenhides the control when false.minandmaxlimit the allowed values. Null leaves that end unrestricted. An out-of-range or non-finitedefaultis rejected before the script runs.
Optional settings can be left out. The value stays fixed during each run. Changing it applies the new settings and may recalculate history.
| Parameter | Type |
|---|---|
default | float |
title | string |
min | float? |
max | float? |
key | string? |
description | string? |
sameLine | bool |
required | bool |
when | bool |
Returns float
Available in Setup only: declarations, setup and state initialisers.
input.group
input.group(title: string = "", key: string? = null, collapsible: bool = false, collapsed: bool = false, when: bool = true) -> voidGroups controls in the script settings.
title labels the group and key identifies it.
collapsiblelets the user fold the group.collapsedstarts the group folded when true.whenhides the group when false.
This adds a group and returns no value.
| Parameter | Type |
|---|---|
title | string |
key | string? |
collapsible | bool |
collapsed | bool |
when | bool |
Available in Setup only: declarations, setup and state initialisers.
input.int
input.int(default: int, title: string = "", min: int? = null, max: int? = null, key: string? = null, description: string? = null, sameLine: bool = false, required: bool = false, when: bool = true) -> intAdds a whole-number input to the script settings.
default sets the starting value.
titlelabels the control;keyidentifies it in saved settings.descriptionadds help text.sameLineplaces the control on the same line as the previous control.requiredmarks the control as required.whenhides the control when false.minandmaxlimit the allowed values and help determine how much history calculations need. An out-of-rangedefaultis rejected before the script runs.
Optional settings can be left out. The value stays fixed during each run. Changing it applies the new settings and may recalculate history.
| Parameter | Type |
|---|---|
default | int |
title | string |
min | int? |
max | int? |
key | string? |
description | string? |
sameLine | bool |
required | bool |
when | bool |
Returns int
Available in Setup only: declarations, setup and state initialisers.
input.section
input.section(title: string = "", key: string? = null, description: string? = null, sameLine: bool = false, when: bool = true) -> voidAdds a section heading to the script settings.
title labels the section, key identifies it, and description adds help
text. Optional settings can be left out. sameLine keeps the section on the
same line; when hides it when false. This adds a heading and returns no value.
| Parameter | Type |
|---|---|
title | string |
key | string? |
description | string? |
sameLine | bool |
when | bool |
Available in Setup only: declarations, setup and state initialisers.
input.select
input.select(default: string, title: string = "", options: string[], key: string? = null, description: string? = null, sameLine: bool = false, required: bool = false, when: bool = true) -> stringAdds a dropdown of text options to the script settings.
default sets the starting selection and should be one of the strings in
options. The result is never null.
titlelabels the control;keyidentifies it in saved settings.descriptionadds help text.sameLineplaces the control on the same line as the previous control.requiredmarks the control as required.whenhides the control when false.
Optional settings can be left out. The value stays fixed during each run. Changing it applies the new settings and may recalculate history.
| Parameter | Type |
|---|---|
default | string |
title | string |
options | string[] |
key | string? |
description | string? |
sameLine | bool |
required | bool |
when | bool |
Returns string
Available in Setup only: declarations, setup and state initialisers.
input.tab
input.tab(title: string = "", key: string? = null) -> voidAdds a tab to the script settings.
title labels the tab and key identifies it. This adds a tab and returns
no value.
| Parameter | Type |
|---|---|
title | string |
key | string? |
Available in Setup only: declarations, setup and state initialisers.
input.timeframe
input.timeframe(default: timeframe = 1h, title: string = "", key: string? = null, description: string? = null, sameLine: bool = false, required: bool = false, when: bool = true) -> timeframeAdds a timeframe picker to the script settings.
default sets the starting timeframe. The result is never null. Invalid
selections are rejected before any handler runs.
titlelabels the control;keyidentifies it in saved settings.descriptionadds help text.sameLineplaces the control on the same line as the previous control.requiredmarks the control as required.whenhides the control when false.
Optional settings can be left out. The value stays fixed during each run. Changing it applies the new settings and may recalculate history.
| Parameter | Type |
|---|---|
default | timeframe |
title | string |
key | string? |
description | string? |
sameLine | bool |
required | bool |
when | bool |
Returns timeframe
Available in Setup only: declarations, setup and state initialisers.