Tables
A table is a panel of cells fixed to a corner of the pane. It is the place for a small summary that should stay put while the chart scrolls.
//@version=5
indicator("Info panel", overlay = true)
var t = table.new(position.top_right, 2, 3, border_color = color.gray, border_width = 1)
table.cell(t, 0, 0, "Panel", text_color = color.white, bgcolor = color.blue)
table.merge_cells(t, 0, 0, 1, 0)
table.cell(t, 0, 1, "Close", text_color = color.white, text_halign = text.align_left)
table.cell(t, 1, 1, str.tostring(close, format.mintick), text_color = color.green, tooltip = "the last close")
Signatures
table.new(position, columns, rows, bgcolor, frame_color, frame_width, border_color, border_width)table.cell(table, column, row, text, width, height, text_color, text_halign, text_valign, text_size, bgcolor, tooltip)table.cell_set_*,table.set_*,table.merge_cells,table.clear,table.delete
Behaviour
- Columns and rows count from 0. A cell outside the table is an error that names it.
- A table sits at a corner or edge of the pane (
position.top_left...bottom_right). A new table replaces the one already at its position, so building one on every bar does not pile them up. - A column is as wide as its widest text.
widthandheightare a percent of the pane instead. - Calling
table.cellagain changes only the arguments you pass. - The default text colour is light grey, readable on the dark chart, not black as on TradingView.
- Hovering a cell that has a
tooltipshows it.