Sidechair

syminfo.prefix()

Browse the reference

Returns the exchange prefix of a ticker id you pass, so syminfo.prefix("NASDAQ:AAPL") gives NASDAQ.

Try it in the editor

syminfo.prefix(symbol) reads any ticker id, not just the chart's. It is the function form of the syminfo.prefix variable, which answers for the current symbol only.

Use it on ids you build or receive as input to sort symbols by venue, for example to group a watchlist by exchange.

Syntax

Pine Script
syminfo.prefix(symbol: simple string) -> simple string
syminfo.prefix(symbol: series string) -> series string

Arguments

NameTypeDefaultDescription
symbolsimple/series stringrequiredA ticker id, usually with a prefix before a colon, such as "NASDAQ:AAPL" or syminfo.tickerid.

Returns

simple/series string: The text before the colon of the ticker id.

Remarks

  • Pass a series string when the id changes bar to bar; the result is then a series string.
  • On Sidechair: not supported yet; the call warns that syminfo.prefix() isn't supported yet and returns na, and the rest of the script keeps running.

Examples

Pine ScriptPrefix of the chart symbolOpen in editor
//@version=6
indicator("Prefix of an id", overlay = true)
p = syminfo.prefix(syminfo.tickerid)
plot(close, "Close", color.gray)
if barstate.islast
    label.new(bar_index, high, na(p) ? "prefix unavailable" : p)
Pine ScriptGroup ids by exchangeOpen in editor
//@version=6
indicator("Exchange of two ids", overlay = true)
first = syminfo.prefix("NASDAQ:AAPL")
second = syminfo.prefix("NYSE:IBM")
plot(close, "Close", color.gray)
if barstate.islast
    label.new(bar_index, high, first + " and " + second, style = label.style_label_down)

See also

Not on Sidechair yet