Docssdk
Built-In Methods Reference
Reference for built-in globals, input helpers, basket declarations, plotting, console helpers, and math helpers.
Reference
Built-In Methods Reference
This page covers the non-TA built-ins that are available to scripts. Use it with:
- Strategy API for
strategy.* - TA Library Reference for
ta.*
Built-In Series
These are available in every script:
openhighlowclosevolumetime
Each one is a series and supports .get(offset).
Basket Surface
| Built-in | Purpose |
|---|---|
symbols(items) |
Declares a fixed multi-symbol basket |
symbol.open[index] |
Open series for basket member |
symbol.high[index] |
High series for basket member |
symbol.low[index] |
Low series for basket member |
symbol.close[index] |
Close series for basket member |
symbol.volume[index] |
Volume series for basket member |
Global Functions
| Method | Purpose |
|---|---|
script(config) |
Declares script type and platform settings |
series(initialValue?) |
Creates a tracked series for crossover and historical logic |
plot(value, options?) |
Draws values on the chart |
input.*
| Method | Purpose |
|---|---|
input.integer(name, defaultValue, options?) |
Integer input |
input.float(name, defaultValue, options?) |
Float input |
input.bool(name, defaultValue) |
Boolean input |
input.string(name, defaultValue, options?) |
String input |
input.source(name, defaultValue) |
Price source input |
input.color(name, defaultValue) |
Color input |
math.*
| Method | Purpose |
|---|---|
math.na() |
Returns NaN |
math.nz(value, replacement?) |
Replaces NaN |
math.abs(value) |
Absolute value |
math.sign(value) |
Sign of value |
math.round(value) |
Round to nearest integer |
math.floor(value) |
Round down |
math.ceil(value) |
Round up |
math.sqrt(value) |
Square root |
math.pow(base, exponent) |
Power |
math.log(value) |
Natural logarithm |
math.exp(value) |
Exponential |
math.max(...values) |
Maximum |
math.min(...values) |
Minimum |
math.avg(...values) |
Average |
math.sum(...values) |
Sum |
plot(...) Options
| Option | Purpose |
|---|---|
type |
Plot type such as line, histogram, area, bar, point, or fill |
color |
Hex or named color |
linewidth |
Stroke width |
linestyle |
Solid, dotted, or dashed |
offset |
Bar offset |
transparency |
Visibility control |
console.*
| Method | Purpose |
|---|---|
console.log(...) |
Standard logging |
console.info(...) |
Informational logging |
console.warn(...) |
Warning logging |
console.error(...) |
Error logging |
Practical Notes
- use
series(...)when you need crossover helpers on a derived value - use
input.source(...)when users should choose the price source - use
symbols([...])only for basket strategies - use
math.*for plain numeric operations andta.*for indicator logic