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 intParameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
timeframe | simple string | No | — | Optional resolution to evaluate the time at (Pine v6 overload). |
session | simple string | No | — | Session spec, e.g. "0930-1100" or "2200-0200:23456". When present, the function returns na outside the session window. |
timezone | simple string | No | — | IANA name ("America/New_York"), "UTC", or "GMT±N". Defaults to UTC. |
bars_back | series int | No | — | 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_back | series int | No | — | Read the `timeframe` bar N back from the one holding the chart bar (negative: ahead). Not combined with a session. |
Returns
series intExample
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.