Sidechair

table.cell_set_text()

Browse the reference

Replaces the text of one cell while leaving its colors, size, alignment and tooltip alone.

Try it in the editor

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

Pine Script
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)) -> void

Arguments

NameTypeDefaultDescription
table_idseries tablerequiredThe table that holds the cell whose words are replaced.
columnseries intrequiredColumn of the cell whose text changes, counting from 0 at the left.
rowseries intrequiredRow of the cell whose text changes, counting from 0 at the top.
textseries 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

Pine ScriptMethod calls refreshing three valuesOpen in editor
//@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