Series, functions, output and settings — assembled from the language inventory in the code.
This reference is assembled from the language inventory inside the terminal's code: if a function is named here it works, and if it works it is named here.
Candle series
| Name | What it is | Arguments |
|---|
open | The bar's open price | none |
high | The bar's highest price | none |
low | The bar's lowest price | none |
close | The bar's close price | none |
volume | The bar's volume | none |
hl2 | Bar midpoint: (high + low) / 2 | none |
hlc3 | Typical price: (high + low + close) / 3 | none |
ohlc4 | Average of the bar's four points | none |
bar_index | Bar number from the start of history | none |
time | Bar time, epoch seconds | none |
Functions
| Name | What it does | Arguments |
|---|
ta.sma | Simple moving average | source — the series to compute over; length — window length, constant |
ta.ema | Exponential moving average; seeded with an SMA over the period | source — the series; length — window length, constant |
ta.rma | Wilder's smoothing (as in RSI and ATR) | source — the series; length — window length, constant |
ta.rsi | Relative strength index, 0…100 | source — the series; length — window length, constant |
ta.atr | Average true range | length — window length, constant |
ta.tr | True range of the current bar | none |
ta.highest | Highest value over the window | source — the series; length — window length, constant |
ta.lowest | Lowest value over the window | source — the series; length — window length, constant |
ta.stdev | Standard deviation | source — the series; length — window length, constant |
ta.change | Difference from the previous bar | source — the series |
ta.crossover | 1 on the bar where the first series crosses the second upwards | source1 — first series; source2 — second series |
ta.crossunder | 1 on the bar where the first series crosses the second downwards | source1 — first series; source2 — second series |
math.abs | Absolute value | x — a number |
math.sqrt | Square root | x — a number |
math.log | Natural logarithm | x — a number |
math.round | Rounding | x — a number |
math.sign | Sign of a number: −1, 0 or 1 | x — a number |
math.max | The greater of two | x — first; y — second |
math.min | The lesser of two | x — first; y — second |
math.pow | Raise to a power | x — base; y — exponent |
nz | Replace “no value” with a replacement (or zero) | source — the series; replacement — what to use instead (optional) |
na | 1 when there is no value | source — the series |
Drawing on the chart
| Name | What it does | Arguments |
|---|
indicator | The indicator header: its name and where to draw | title — indicator name; overlay — over the candles or in its own pane (optional); precision — decimal places (optional) |
plot | Draw a series as a line | series — what to draw; title — line label (optional); color — colour (optional); width — thickness (optional); style — line kind: 0 line, 5 histogram (optional); offset — shift in bars: forward (+) or back (−) (optional) |
hline | A horizontal line at a given price | price — the price; title — label (optional); color — colour (optional) |
fill | Fill between two plotted lines | plot1 — first line; plot2 — second line; color — colour when the first line is above (optional); colorDown — colour when it is below (optional); opacity — density, percent (optional) |
Indicator settings
| Name | What it does | Arguments |
|---|
input.int | An integer setting | title — label in the form; defval — default value; minval — no less than (optional); maxval — no more than (optional) |
input.float | A fractional setting | title — label; defval — default; minval — no less than (optional); maxval — no more than (optional) |
input.bool | A switch | title — label; defval — default |
input.string | A text setting | title — label; defval — default |
input.color | A colour setting | title — label; defval — default |
input.source | A series picker: close, hl2 and the rest | title — label; defval — default |
Colours
| Name | What it does | Arguments |
|---|
color.rgb | An exact colour from components | r — red 0…255; g — green; b — blue; a — opacity (optional) |
color.bull | The theme's colour for a rise | none |
color.sell | The theme's colour for a fall | none |
color.text | Main text colour | none |
color.soft | Muted colour | none |
color.accent | Accent colour | none |
color.grid | Grid colour | none |