Replaces the text of one cell while leaving its colors, size, alignment and tooltip alone.
table.cell_set_text(t, 1, 0, "42") rewrites the text in column 1, row 0 and nothing else. It is the light way to refresh a number each bar, because the styling arguments of table.cell() are not repeated.
An empty string blanks the cell without removing it. Like every table call it can be written as a method, t.cell_set_text(1, 0, "42").
Syntax
table.cell_set_text(table_id: series table, column: series int, row: series int, text: series string (optional)) -> void
table.cell_set_text(column: series int, row: series int, text: series string (optional)) -> voidArguments
| Name | Type | Default | Description |
|---|---|---|---|
| table_id | series table | required | The table that holds the cell whose words are replaced. |
| column | series int | required | Column of the cell whose text changes, counting from 0 at the left. |
| row | series int | required | Row of the cell whose text changes, counting from 0 at the top. |
| text | series string | "" | The new words for the cell. An empty string blanks it; the cell's colors and size stay. |
Returns
Nothing.
Remarks
- Giving a column or row beyond the table's size stops the script with a runtime error.
Example
//@version=6
indicator("table.cell_set_text: method form", overlay = true)
var t = table.new(position.top_right, 2, 3, bgcolor = color.new(color.gray, 70))
if barstate.isfirst
t.cell(0, 0, "Open")
t.cell(0, 1, "High")
t.cell(0, 2, "Low")
t.cell(1, 0, "")
t.cell(1, 1, "")
t.cell(1, 2, "")
t.cell_set_text(1, 0, str.tostring(open, "#.##"))
t.cell_set_text(1, 1, str.tostring(high, "#.##"))
t.cell_set_text(1, 2, str.tostring(low, "#.##"))See also
Runs on Sidechair