Reference
General
Core helpers: testing for missing values and changing types.
bool(x)
Converts to bool (na and 0 are false).
Returns: true or false
| Parameter | Type |
|---|---|
x | any |
color(x)
Casts to color.
Returns: a color
| Parameter | Type |
|---|---|
x | any |
fixnan(x)
The last non-na value of x. Call on every bar: it keeps its own running memory.
Returns: the same type as the first argument
| Parameter | Type |
|---|---|
x | any |
float(x)
Converts to a float.
Returns: a number
| Parameter | Type |
|---|---|
x | any |
int(x)
Converts to a whole number (truncates toward zero).
Returns: a whole number
| Parameter | Type |
|---|---|
x | any |
na(x)
True if x is na (missing).
Returns: true or false
| Parameter | Type |
|---|---|
x | any |
nz(x, replacement=0)
x, or replacement when x is na.
Returns: the same type as the first argument
| Parameter | Type | Notes |
|---|---|---|
x | any | |
replacement | any | Default 0 |
string(x)
Converts to text.
Returns: text
| Parameter | Type |
|---|---|
x | any |
timestamp(year, month, day, hour=0, minute=0, second=0)
Time in ms (UTC) for a date.
Returns: a whole number
| Parameter | Type | Notes |
|---|---|---|
year | int | |
month | int | |
day | int | |
hour | int | Default 0 |
minute | int | Default 0 |
second | int | Default 0 |
Education only. Not financial advice. Examples are teaching samples, not trading results.
