static variable, and fill the
cells on barstate.islast, so the work is done for the one bar the reader looks at and not for every bar of the history.
table.new(position, columns, rows) makes the grid and table.cell(table, column, row, text) sets a cell; columns and rows count from
0. Cell text is a string, so convert numbers with str.tostring.
table.cell also takes textcolor, bgcolor, size, width and height. To change only the text of a cell later, use
table.cell_set_text(table, column, row, text).
Limits
- Position is one of the nine
position.*constants (position.top_left,position.middle_center,position.bottom_right, …). - A chart holds one table per position. Creating a second table at the same position deletes the first, so a script has at most nine tables.
- Cell text is at most 999 characters; a longer string stops the script when it runs.
The mistake to avoid
Callingtable.new on every bar. Each call makes a new table that replaces the one at that position, so the table is rebuilt
on every bar. Create it once in a static variable, as above.
See Tables.