Functions
table.new()
Creates a new table at a chart position. If a table already exists at that position, the previous table is deleted. At most 9 tables can exist (one per position.*).
Syntax
table.new(series string position, series int columns, series int rows, series color bgcolor, series color frame_color, series int frame_width, series color border_color, series int border_width, const bool force_overlay) → series table
Arguments
position required series string Where to place the table. One of position.top_left, top_center, top_right, middle_left, middle_center, middle_right, bottom_left, bottom_center, bottom_right. columns required series int Number of columns. Must be >= 1. rows required series int Number of rows. Must be >= 1. bgcolor series color Background color of the table. Optional. frame_color series color Outer frame color. Optional. frame_width series int Outer frame width in pixels. Default is 0. border_color series color Inner cell-border color. Optional. border_width series int Inner cell-border width in pixels. Default is 0. force_overlay const bool If true, draw on the main pane even when the script is not overlay. Default is false. Return Type
series table Example
//@lipi=2
indicator("table.merge_cells example")
SMA50 = talib.sma(close, 50)
SMA100 = talib.sma(close, 100)
SMA200 = talib.sma(close, 200)
if barstate.islast {
maTable = table.new(position.bottom_right, 3, 3, bgcolor=color.gray, border_width=1, border_color=color.black)
table.cell(maTable, 0, 0, text="SMA Table")
table.merge_cells(maTable, 0, 0, 2, 0)
table.cell(maTable, 0, 1, text="SMA 50")
table.cell(maTable, 1, 1, text="SMA 100")
table.cell(maTable, 2, 1, text="SMA 200")
table.cell(maTable, 0, 2, bgcolor=color.white, text=str.tostring(SMA50))
table.cell(maTable, 1, 2, bgcolor=color.white, text=str.tostring(SMA100))
table.cell(maTable, 2, 2, bgcolor=color.white, text=str.tostring(SMA200))
}