Functions
Market · interval · time
11 names in this group.
Each comes with its signature and an example.
bar
The bars: count, index (0, 1, 2… as a series), last (the latest index), confirmed (the latest bar has closed; false while it is forming)
const bar: { count: number; index: Series; last: number; confirmed: boolean }map((i) => (i === bar.last && !bar.confirmed ? NaN : close[i]))syminfo
The market: symbol 'BINANCEF:BTCUSDT', ticker 'BTCUSDT', exchange 'BINANCEF', market (spot, perp, stock…), currency 'USDT' / 'KRW', tick (the price step at the latest price; NaN when unknown), timezone (the market's: 'UTC' for crypto, 'Asia/Seoul' for Korean stocks). Unknown text is ''
const syminfo: { symbol: string; ticker: string; exchange: string; name: string; market: 'spot' | 'perp' | 'stock' | 'index' | 'other' | 'unknown'; currency: string; base: string; tick: number; timezone: string }const step = Number.isNaN(syminfo.tick) ? 0.01 : syminfo.ticktimeframe
The chart's interval: period ('60', '1D', '1W'…), minutes per bar, isIntraday (shorter than a day)…
const timeframe: { period: string; minutes: number; seconds: number; isIntraday: boolean; isDaily: boolean; isWeekly: boolean; isMonthly: boolean }const len = timeframe.isIntraday ? 50 : 20date.hour
The hour (0–23) each bar opens at, in the market's zone (syminfo.timezone) unless one is given, e.g. date.hour('Asia/Seoul')
hour(tz?: string): Seriesdate.hour('Asia/Seoul')date.minute
The minute (0–59) each bar opens at
minute(tz?: string): Seriesdate.dayofweek
Weekday: 0 Sunday … 6 Saturday (as in JavaScript, not Pine)
dayofweek(tz?: string): Seriesdate.day
Day of the month (1–31)
day(tz?: string): Seriesdate.month
Month (1–12)
month(tz?: string): Seriesdate.year
Year
year(tz?: string): Seriesdate.isNew
True on the first bar of each day ('D', default), week ('W', from Monday), month ('M') or year ('Y')
isNew(period?: Period, tz?: string): Condbgcolor(date.isNew('W'), { color: color.alpha(color.gray, 0.15) })date.session
True on bars opening inside 'HHMM-HHMM' (an earlier end runs past midnight: '2200-0200')
session(spec: string, tz?: string): Conddate.session('0900-1530', 'Asia/Seoul')