Exciting Update: Version 1.0.6 is now available, introducing Direct Pine Script Mode, Pine Logs Runtime Bridge, Zero-Repaint Linting, Source Maps, Intrabar MFE/MAE Stats, and expanded Pine v5/v6 Transpiler Parity. Read more
Version: 1.0.6

HUD Tables

Pine Script-style Stats Dashboard overlays designed to render analytics directly in the viewport corners.

ctx.table.new(position, columns, rows, bg, border_c, border_w)

Initializes a new rectangular table layout in one of the viewport corners.

BacktestX Script
const myTable = ctx.table.new(
  ctx.position.bottom_right, 
  2, 
  4, 
  'rgba(26, 26, 46, 0.85)', 
  'rgba(57, 62, 70, 0.4)', 
  1
);

table.cell(col, row, text, options)

Exposes properties to populates cell values, backgrounds, and styling alignments. Options:

BacktestX Script
myTable.cell(0, 0, 'Metric', { 
  bgcolor: '#222831', 
  color: '#00adb5', 
  size: ctx.size.normal, 
  halign: 'center' 
});

Available Cell Options:

  • color: Text color (e.g. hex, rgb, rgba).
  • bgcolor: Cell background fill color.
  • size: Text size constant (from ctx.size).
  • halign: Horizontal text alignment: 'left' | 'center' | 'right'.
  • font: Custom font family string override.
  • border_color: Border outline color for the cell.
  • border_width: Thickness of cell borders.

table.set_merge(tableObj, startCol, startRow, endCol, endRow)

Merges a rectangular grid of cells (from startCol, startRow to endCol, endRow) into a single large cell. Perfect for table titles or wide data segments.

BacktestX Script
table.set_merge(myTable, 0, 0, 1, 0); // Merges columns 0 and 1 in row 0

Alignments & Constants

Exposed structures mapping layout constants on ctx:

ctx.position

Anchors HUD panels to screen bounds:

  • ctx.position.top_left
  • ctx.position.top_right
  • ctx.position.bottom_left
  • ctx.position.bottom_right

ctx.size

Formats cell text sizes dynamically:

  • ctx.size.tiny
  • ctx.size.small
  • ctx.size.normal
  • ctx.size.large
  • ctx.size.huge

Direct Pine HUDs & Strategy KPI Cards (v1.0.6)

In Direct Pine Mode (v1.0.6), persist a single HUD table with var and populate cells inside if barstate.islast. For backtest strategies, you can also push custom KPI cards and per-trade labels directly into the Strategy Tester UI via strategy.set_metric() and strategy.tag_trade().

Pine Script (v1.0.6)
var hud = table.new(position.top_right, 2, 2, bgcolor=color.new(color.black, 20))
if barstate.islast
    table.cell(hud, 0, 0, "Symbol", text_color=color.gray)
    table.cell(hud, 1, 0, syminfo.ticker, text_color=color.white)
    table.cell(hud, 0, 1, "HLC3", text_color=color.gray)
    table.cell(hud, 1, 1, str.tostring(hlc3, "#.##"), text_color=color.teal)