Tables & charts

8 functions

TABLE_CELL(DATA, COLOR, ALIGN, BGCOLOR)

One table cell. DATA may be a string or a series, in which case the final value is shown to two decimals. ALIGN is 'left', 'center' or 'right'.

DATA(series)
Cell contents. A series shows its FINAL value, to two decimals.
COLOR(color)
Text colour.
ALIGN(string)
'left', 'center' or 'right'.
BGCOLOR(color)
Cell background colour. Optional.
// a cell is a value, not a statement — build cells into rows,
// rows into a table, and only DRAWTABLE actually draws
LABEL := TABLE_CELL('close', COLORWHITE, 'left');
VALUE := TABLE_CELL(CLOSE, COLORYELLOW, 'right');
DRAWTABLE(TABLE_ROW(LABEL, VALUE));
TABLE_ROW(CELL, CELL, …)

Assemble cells into one row.

CELL(series)
A TABLE_CELL value. Pass as many as the row needs.
// keep the cell count identical on every row, or the
// columns will not line up
R1 := TABLE_ROW(TABLE_CELL('close', COLORWHITE, 'left'),
                TABLE_CELL(CLOSE,   COLORYELLOW, 'right'));
R2 := TABLE_ROW(TABLE_CELL('ATR',   COLORWHITE, 'left'),
                TABLE_CELL(EXPMEMA(TR, 14), COLORYELLOW, 'right'));
DRAWTABLE(R1, R2);
DRAWTABLE(ROW, ROW, …)

Render the rows as a table on the pane.

ROW(series)
A TABLE_ROW value. Rows are drawn top to bottom in the order given.
// a compact stats panel — remember every cell shows the
// series' LAST value, so this reads as "current state"
DRAWTABLE(
  TABLE_ROW(TABLE_CELL('close', COLORWHITE, 'left'),
            TABLE_CELL(CLOSE, COLORYELLOW, 'right')),
  TABLE_ROW(TABLE_CELL('MA20', COLORWHITE, 'left'),
            TABLE_CELL(MA(CLOSE, 20), COLORYELLOW, 'right')));
PIE_CELL(VALUE, COLOR, TEXT, TEXTCOLOR, LINECOLOR)

One pie slice.

VALUE(series)
Slice size. The final value is used; slices are scaled to their total.
COLOR(color)
Slice fill colour.
TEXT(string)
Slice label.
TEXTCOLOR(color)
Label colour.
LINECOLOR(color)
Leader-line colour.
// up-bar versus down-bar volume over the last 20 bars
UPV := SUM(IF(CLOSE > OPEN, VOL, 0), 20);
DNV := SUM(IF(CLOSE < OPEN, VOL, 0), 20);
DRAWPIE(PIE_CELL(UPV, COLORGREEN, 'up', COLORWHITE, COLORGRAY),
        PIE_CELL(DNV, COLORRED,   'down', COLORWHITE, COLORGRAY));
DRAWPIE(CELL, CELL, …)

Render slices as a pie chart.

CELL(series)
A PIE_CELL value. Slices are scaled to the sum of all values given.
// values need not add to 100 — they are normalised for you
DRAWPIE(PIE_CELL(COUNT(CLOSE > OPEN, 20), COLORGREEN, 'up',
                 COLORWHITE, COLORGRAY),
        PIE_CELL(COUNT(CLOSE < OPEN, 20), COLORRED, 'down',
                 COLORWHITE, COLORGRAY));
DRAWDOUGHNUT(CELL, CELL, …)

Render slices as a doughnut chart.

CELL(series)
A PIE_CELL value — the same cells DRAWPIE takes.
// identical inputs to DRAWPIE, only the shape differs
DRAWDOUGHNUT(PIE_CELL(COUNT(CLOSE > OPEN, 20), COLORGREEN, 'up',
                      COLORWHITE, COLORGRAY),
             PIE_CELL(COUNT(CLOSE < OPEN, 20), COLORRED, 'down',
                      COLORWHITE, COLORGRAY));
RADAR_CELL(NAME, VALUE, MAX, MIN)

One radar axis with its own scale.

NAME(string)
Axis label.
VALUE(series)
Where the point sits on this axis. The final value is used.
MAX(float)
Top of this axis' own scale.
MIN(float)
Bottom of this axis' own scale — each axis scales independently.
// each axis carries its own MIN/MAX, so quantities with
// completely different units can share one radar
DRAWRADAR(RADAR_CELL('RSI', RSI, 100, 0),
          RADAR_CELL('vol ratio', VOL / MA(VOL, 20), 3, 0),
          RADAR_CELL('trend', SLOPE(CLOSE, 20) / CLOSE * 100, 1, -1));
DRAWRADAR(CELL, CELL, …)

Render the axes as a radar chart.

CELL(series)
A RADAR_CELL value. Three or more axes make a readable shape.
// fewer than three axes collapses into a line — give it
// at least three dimensions to be worth drawing
DRAWRADAR(RADAR_CELL('RSI', RSI, 100, 0),
          RADAR_CELL('KDJ', K, 100, 0),
          RADAR_CELL('CCI', CCI, 200, -200));