Functions
table.cell()
Defines a cell at (column, row). If that cell was previously merged as an origin, its colspan/rowspan is kept. Covered cells from a merge are not created as placeholders.
Syntax
table.cell(series table id, series int column, series int row, series string text, series float width, series float height, series color text_color, series string text_halign, series string text_valign, series string text_size, series color bgcolor, series string tooltip, series string text_font_family, series string text_formatting) → void
Arguments
id required series table Table object. column required series int 0-based column index. row required series int 0-based row index. text series string Cell text. Default is an empty string. width series float Cell width as a percentage of the pane. Default is 0 (auto). height series float Cell height as a percentage of the pane. Default is 0 (auto). text_color series color Text color. Optional. text_halign series string Horizontal text align: left, center, or right. Default is center. text_valign series string Vertical text align: top, center, or bottom. Default is center. text_size series string Text size. Default is normal. bgcolor series color Cell background color. Optional. tooltip series string Tooltip text. Default is an empty string. text_font_family series string Font family. Default is default. text_formatting series string Text formatting. Default is none. Return Type
void 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))
}