table(x) gives na a table type, so a variable can be declared as a table before table.new() fills it.
table(na) is the typed na to start from when a variable will later hold a table, as in var t = table(na). A table that already exists passes through unchanged.
The same job is done by var table t = na, which reads more clearly in most scripts.
Syntax
table(x: series table) -> series tableArguments
| Name | Type | Default | Description |
|---|---|---|---|
| x | series table | required | The value to treat as a table. Pass na to get an empty, table-typed variable; a real table is returned as is. |
Returns
series table: The argument, typed as a table. A table-typed na when na was passed.
Example
//@version=6
indicator("table cast: typed na", overlay = true)
var t = table(na)
plot(na(t) ? 1 : 0, "Table is na")See also
Runs on Sidechair