Skip to main content

chart.symbol#

The chart's active symbol (exchange-native ticker like BTCUSDT, ETHUSDT, or BTC-PERP).

SYNTAX#

ctx.symbol: string

RETURNS#

string — exchange-native ticker, or "" when unset.

REMARKS#

Pair with ctx.exchange to disambiguate cross-venue symbols. Use as the symbol option to source(...) to pin a different symbol for the same indicator.

EXAMPLE#

function onBar(i, ctx) {
  if (ctx.isLast) {
    entity.label({
      key: 'header',
      x: candles[i].time, y: candles[i].close,
      text: ctx.symbol + ' on ' + ctx.exchange,
      color: '#ffffff'
    });
  }
}

SEE ALSO#

chart.exchange, chart.timeframe, data.source