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

Metadata / Reference

alerta.time_close

TradingView-compatible spelling: time_close, runs without warnings

Returns the bar's close time (epoch milliseconds): open + timeframe, calendar months for monthly bars, and the session close for a stock's daily bar. Also usable as a bare built-in variable. Takes the same optional arguments as `time`: with a timeframe, `time_close("D")` is the close of the higher-timeframe bar the current bar belongs to; with a session, the value is the close time inside the session window and `na` outside.

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

Parameters

NameTypeRequiredDefaultDescription
timeframesimple stringNo—Optional resolution to evaluate the close time at.
sessionsimple stringNo—Session spec, e.g. "0930-1600". When present, returns na outside the session window.
timezonesimple stringNo—IANA name, "UTC", or "GMT±N". Defaults to UTC.
bars_backseries intNo—The close of the chart bar N back (a negative N reads the bar N ahead; past the last loaded bar the chart's timeframe steps on).
timeframe_bars_backseries intNo—The close of 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_close
plot(time_close(), { pane: "oscillator" })plot(nz(time_close("D"), time), { title: "session close", 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.