Reference
Declaration and inputs
The indicator() line and every input.* setting.
indicator(title, shorttitle="", overlay=false, format="price", precision=na, max_bars_back=500, max_labels_count=50, max_lines_count=50, max_boxes_count=50, max_tables_count=10, scale="right", timeframe="", explicit_plot_zorder=false)
Declares the script: its title and where it draws. Call at the top level of the script.
Returns: nothing
| Parameter | Type | Notes |
|---|---|---|
title | string | |
shorttitle | string | Default "" |
overlay | bool | Default false |
format | string | Default "price" |
precision | int | Default na |
max_bars_back | int | Default 500 |
max_labels_count | int | Default 50 |
max_lines_count | int | Default 50 |
max_boxes_count | int | Default 50 |
max_tables_count | int | Default 10 |
scale | string | Default "right" |
timeframe | string | Default "" |
explicit_plot_zorder | bool | Default false |
input(defval, title="", tooltip="", group="", inline="", confirm=false, display="all")
A setting; its type comes from the default value. Call at the top level of the script.
Returns: the same type as the first argument
| Parameter | Type | Notes |
|---|---|---|
defval | any | |
title | string | Default "" |
tooltip | string | Default "" |
group | string | Default "" |
inline | string | Default "" |
confirm | bool | Default false |
display | string | Default "all" |
input.bool(defval, title="", tooltip="", group="", inline="", confirm=false, display="all")
An on/off setting. Call at the top level of the script.
Returns: true or false
| Parameter | Type | Notes |
|---|---|---|
defval | bool | |
title | string | Default "" |
tooltip | string | Default "" |
group | string | Default "" |
inline | string | Default "" |
confirm | bool | Default false |
display | string | Default "all" |
input.color(defval, title="", tooltip="", group="", inline="", confirm=false, display="all")
A color setting. Call at the top level of the script.
Returns: a color
| Parameter | Type | Notes |
|---|---|---|
defval | color | |
title | string | Default "" |
tooltip | string | Default "" |
group | string | Default "" |
inline | string | Default "" |
confirm | bool | Default false |
display | string | Default "all" |
input.float(defval, title="", minval=na, maxval=na, step=na, options=na, tooltip="", group="", inline="", confirm=false, display="all")
A decimal-number setting. Call at the top level of the script.
Returns: a number
| Parameter | Type | Notes |
|---|---|---|
defval | float | |
title | string | Default "" |
minval | float | Default na |
maxval | float | Default na |
step | float | Default na |
options | array | Default na |
tooltip | string | Default "" |
group | string | Default "" |
inline | string | Default "" |
confirm | bool | Default false |
display | string | Default "all" |
input.int(defval, title="", minval=na, maxval=na, step=1, options=na, tooltip="", group="", inline="", confirm=false, display="all")
A whole-number setting. Call at the top level of the script.
Returns: a whole number
| Parameter | Type | Notes |
|---|---|---|
defval | int | |
title | string | Default "" |
minval | int | Default na |
maxval | int | Default na |
step | int | Default 1 |
options | array | Default na |
tooltip | string | Default "" |
group | string | Default "" |
inline | string | Default "" |
confirm | bool | Default false |
display | string | Default "all" |
input.price(defval, title="", tooltip="", group="", inline="", confirm=false, display="all")
A price-level setting. Call at the top level of the script.
Returns: a number
| Parameter | Type | Notes |
|---|---|---|
defval | float | |
title | string | Default "" |
tooltip | string | Default "" |
group | string | Default "" |
inline | string | Default "" |
confirm | bool | Default false |
display | string | Default "all" |
input.source(defval=close, title="", tooltip="", group="", inline="", confirm=false, display="all")
A price source setting (open, high, low, close, volume, hl2, hlc3, ohlc4, hlcc4). Call at the top level of the script.
Returns: a number
| Parameter | Type | Notes |
|---|---|---|
defval | float | Default close |
title | string | Default "" |
tooltip | string | Default "" |
group | string | Default "" |
inline | string | Default "" |
confirm | bool | Default false |
display | string | Default "all" |
input.string(defval, title="", options=na, tooltip="", group="", inline="", confirm=false, display="all")
A text setting (or a dropdown with options). Call at the top level of the script.
Returns: text
| Parameter | Type | Notes |
|---|---|---|
defval | string | |
title | string | Default "" |
options | array | Default na |
tooltip | string | Default "" |
group | string | Default "" |
inline | string | Default "" |
confirm | bool | Default false |
display | string | Default "all" |
input.symbol(defval="", title="", tooltip="", group="", inline="", confirm=false, display="all")
A symbol setting ("" = chart symbol). Call at the top level of the script.
Returns: text
| Parameter | Type | Notes |
|---|---|---|
defval | string | Default "" |
title | string | Default "" |
tooltip | string | Default "" |
group | string | Default "" |
inline | string | Default "" |
confirm | bool | Default false |
display | string | Default "all" |
input.text_area(defval, title="", tooltip="", group="", confirm=false, display="all")
A multi-line text setting. Call at the top level of the script.
Returns: text
| Parameter | Type | Notes |
|---|---|---|
defval | string | |
title | string | Default "" |
tooltip | string | Default "" |
group | string | Default "" |
confirm | bool | Default false |
display | string | Default "all" |
input.timeframe(defval="", title="", options=na, tooltip="", group="", inline="", confirm=false, display="all")
A timeframe setting ("" = chart timeframe). Call at the top level of the script.
Returns: text
| Parameter | Type | Notes |
|---|---|---|
defval | string | Default "" |
title | string | Default "" |
options | array | Default na |
tooltip | string | Default "" |
group | string | Default "" |
inline | string | Default "" |
confirm | bool | Default false |
display | string | Default "all" |
Education only. Not financial advice. Examples are teaching samples, not trading results.
