table.new() - Pine Script Function
table.new()
Section titled “table.new()”Overview
Section titled “Overview”The function creates a new table.
Syntax
Section titled “Syntax”table.new(position, columns, rows, bgcolor, frame_color, frame_width, border_color, border_width, force_overlay) → series tableParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| position | series string | Position of the table. Possible values are: position.top_left |
| position.top_center | — | — |
| position.top_right | — | — |
| position.middle_left | — | — |
| position.middle_center | — | — |
| position.middle_right | — | — |
| position.bottom_left | — | — |
| position.bottom_center | — | — |
| position.bottom_right. | — | — |
Returns
Section titled “Returns”The ID of a table object that can be passed to other table.*() functions.
Remarks
Section titled “Remarks”- This function creates the table object itself, but the table will not be displayed until its cells are populated. To define a cell and change its contents or attributes, use table.cell and other table.cell_*() functions.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("table.new example")var testTable = table.new(position = position.top_right, columns = 2, rows = 1, bgcolor = color.yellow, border_width = 1)if barstate.islasttable.cell(table_id = testTable, column = 0, row = 0, text = "Open is " + str.tostring(open))table.cell(table_id = testTable, column = 1, row = 0, text = "Close is " + str.tostring(close), bgcolor=color.teal)