TradingCharts

Chart Information

The runtime exposes everything the script knows about the chart it is running on through three namespaces: syminfo.*, chart.*, and timeframe.*.

syminfo.*

Metadata about the chart symbol. Identity and contract fields come from the security master; company facts (sector, shareholders, analyst recommendations, shares outstanding) come from the scrip details the platform syncs per ISIN and are available for listed equities only. Any field the platform has no value for reads "" (strings) or na (numbers) — guard with na() or a string compare before using it.

Identity

Name Type Example value (TCS on NSE)
syminfo.tickerid string "NSEE11536:TCS" — exchange + segment + security id, then the ticker
syminfo.ticker string "TCS"
syminfo.symbol string "TCS" (alias of ticker)
syminfo.prefix string "NSEE11536" — the part of tickerid before the colon
syminfo.root string "TCS"
syminfo.main_tickerid string "TCS" — the security-master symbol (same for the equity and its derivatives)
syminfo.description string "TATA CONSULTANCY SERV LT"
syminfo.type string "EQUITY", "FUTIDX", "FUTSTK", "OPTIDX", "OPTSTK", "IDX", "FUTCOM", … (security-master instrument name)
syminfo.isin string "INE467B01029"

Market

Name Type Value
syminfo.currency string "INR"
syminfo.basecurrency string "INR"
syminfo.country string "IN"
syminfo.timezone string "Asia/Kolkata"
syminfo.session string "regular" — the session type, comparable with session.regular / session.extended; it is not the trading hours string
syminfo.volumetype string "base"

Contract

Name Type Example value
syminfo.mintick float 0.05 — tick size from the security master
syminfo.minmove int 1
syminfo.pricescale int 20 — round(1 / mintick)
syminfo.pointvalue float 1
syminfo.mincontract int lot size — 1 for equities, e.g. 25 for a NIFTY option
syminfo.expiration_date int contract expiry as a UNIX timestamp in milliseconds (IST); na for equities and indices — format with str.format_time()

Company facts (equities only)

Name Type Example value (TCS)
syminfo.sector string "Information Technology"
syminfo.industry string "Computer Software & Consulting"
syminfo.shareholders int 2605180
syminfo.shares_outstanding_total int 3618087518
syminfo.shares_outstanding_float int 1021386106 — total shares × (1 − promoter holding %), a free-float estimate
syminfo.recommendations_buy int 21
syminfo.recommendations_hold int 14
syminfo.recommendations_sell int 5
syminfo.recommendations_total int 40
syminfo.employees int always na — no data source yet

Not available (compile error): syminfo.current_contract, syminfo.recommendations_buy_strong, syminfo.recommendations_sell_strong, syminfo.recommendations_date, and the six analyst targets syminfo.target_price_average, _date, _estimates, _high, _low, _median. The full platform list is on What is not supported.

//@version=6
indicator("Symbol facts", overlay = true)
if barstate.islast
    buyShare = na(syminfo.recommendations_total) or syminfo.recommendations_total == 0 ? na : 100 * syminfo.recommendations_buy / syminfo.recommendations_total
    txt = syminfo.description + "\n" + (syminfo.sector == "" ? "sector n/a" : syminfo.sector) + "\nBuy ratings: " + (na(buyShare) ? "na" : str.tostring(buyShare, "#") + "%")
    label.new(bar_index, high, txt, style = label.style_label_down)

chart.*

Information about the chart's current state:

Name Type Meaning
chart.left_visible_bar_time int Epoch ms of the leftmost visible bar. ≈ full-range start when the viewport is not yet reported.
chart.right_visible_bar_time int Epoch ms of the rightmost visible bar.
chart.is_standard bool true for candles / line / bar charts.
chart.is_heikinashi bool
chart.is_renko bool
chart.is_kagi bool
chart.is_linebreak bool
chart.is_range bool
chart.is_pnf bool Point-and-figure.
chart.fg_color color Theme foreground (adapts light/dark at render time).
chart.bg_color color Theme background.

timeframe.*

Name Type Meaning
timeframe.period string "5", "60", "D", "W", "M"
timeframe.multiplier int Numeric part (5 for "5", 1 for "D")
timeframe.isintraday bool
timeframe.isminutes bool
timeframe.isseconds bool
timeframe.isdaily bool
timeframe.isweekly bool
timeframe.ismonthly bool

Example — a status badge

var table t = table.new(position.top_right, 1, 1, bgcolor=color.new(color.black, 20))
if barstate.islast
    table.cell(t, 0, 0,
        syminfo.ticker + " · " + timeframe.period + " · " + str.tostring(close, "#.##"),
        text_color=color.white, text_halign=text.align_left, text_size=size.small)

See also