Skip to content
AlertaChartAlertaScript / docs
AlertaScript / alerta.time
On this pageSignatureParametersReturnsExample

Metadata / Reference

alerta.time

TradingView-compatible spelling: time, runs without warnings

Returns bar open timestamps (epoch milliseconds). Also usable as a bare built-in variable (no parens). The Pine v6 overload `time(timeframe, session?, timezone?, bars_back?, timeframe_bars_back?)` is accepted; when a session is supplied the value is the bar time inside the session window (in the given timezone) and `na` outside.

alerta.time() or time(timeframe, session?, timezone?, bars_back?, timeframe_bars_back?) → series int

Parameters

NameTypeRequiredDefaultDescription
timeframesimple stringNo—Optional resolution to evaluate the time at (Pine v6 overload).
sessionsimple stringNo—Session spec, e.g. "0930-1100" or "2200-0200:23456". When present, the function returns na outside the session window.
timezonesimple stringNo—IANA name ("America/New_York"), "UTC", or "GMT±N". Defaults to UTC.
bars_backseries intNo—Read the chart bar N back (a negative N reads the bar N ahead; past the last loaded bar the chart's timeframe steps on). Applied before the session mask; used to detect session edges.
timeframe_bars_backseries intNo—Read the `timeframe` bar N back from the one holding the chart bar (negative: ahead). Not combined with a session.

Returns

series int

Example

alerta.time
plot(time, { pane: "oscillator" })plot(time(timeframe.period), { pane: "oscillator" })plot(time("D", timeframe_bars_back = 1), { title: "previous day open", pane: "oscillator" })

Names and aliases

Guides and navigation are localized. Built-in reference descriptions and code examples are maintained in English.

AlertaScript

No results found.

Search by name, alias, or keyword.