The nine screen positions a table can take: top, middle or bottom, combined with left, center or right.
position.* constants go in the position argument of table.new, which fixes the table to a corner, an edge or the centre of the pane. They are named row first, column second: position.top_right is the top-right corner, position.middle_center the middle of the pane.
A table is anchored to the pane, not to bars, so it does not scroll with the chart.
Constants
| Name | Value | Description |
|---|---|---|
position.bottom_center | Bottom edge, horizontally centred. | |
position.bottom_left | Bottom-left corner. | |
position.bottom_right | Bottom-right corner. | |
position.middle_center | The centre of the pane. | |
position.middle_left | Left edge, vertically centred. | |
position.middle_right | Right edge, vertically centred. | |
position.top_center | Top edge, horizontally centred. | |
position.top_left | Top-left corner. | |
position.top_right | Top-right corner. |
Remarks
- Two tables can share a position; the later
table.newcall draws on top.
Example
//@version=6
indicator("Stats table", overlay = true)
var t = table.new(position.top_right, 2, 2)
if barstate.islast
table.cell(t, 0, 0, "Close")
table.cell(t, 1, 0, str.tostring(close, "#.##"))
table.cell(t, 0, 1, "Volume")
table.cell(t, 1, 1, str.tostring(volume, "#"))
plot(close, "Close", color.gray)See also
Runs on Sidechair