table.merge_cells() - Pine Script Function
table.merge_cells()
Section titled “table.merge_cells()”Overview
Section titled “Overview”The function merges a sequence of cells in the table into one cell. The cells are merged in a rectangle shape where the start_column and start_row specify the top-left corner, and end_column and end_row specify the bottom-right corner.
Syntax
Section titled “Syntax”table.merge_cells(table_id, start_column, start_row, end_column, end_row) → voidParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| table_id | series table | A table object. |
Remarks
Section titled “Remarks”- This function will merge cells, even if their properties are not yet defined with table.cell.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("table.merge_cells example")SMA50 = ta.sma(close, 50)SMA100 = ta.sma(close, 100)SMA200 = ta.sma(close, 200)if barstate.islast maTable =table.new(position.bottom_right, 3, 3, bgcolor = color.gray, border_width = 1, border_color = color.black) // Header table.cell(maTable, 0, 0, text = "SMA Table")table.merge_cells(maTable, 0, 0, 2, 0) // Cell Titles table.cell(maTable, 0, 1, text = "SMA 50")table.cell(maTable, 1, 1, text = "SMA 100")table.cell(maTable, 2, 1, text = "SMA 200") // Values 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))