Skip to content
AlertaChartAlertaScript / docs
AlertaScript / Time

Reference

Time

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

Name / SignatureDescriptionReturns
alerta.timeframe.changetimeframe.change(timeframe) → series boolPine v6: returns true on the first bar of every new period of the specified timeframe. Use it to anchor higher-timeframe-driven pivots, VWAP and aggregations.series bool
alerta.session.regularsession.regularPine v5/v6 session identifier — exchange's regular trading hours. Used as the `session` argument to `time()` / `input.session()`.string
alerta.session.extendedsession.extendedPine v5/v6 session identifier — extended (pre + after) trading hours.string
alerta.session.ismarketsession.ismarket → series<bool>Pine v5/v6 series<bool>: true on every bar that opens inside the exchange's regular trading hours, read on the exchange's own clock (so daylight saving moves the window with it — 09:30–16:00 New York time for a US stock). Weekends are closed; exchange holidays are not modelled. A daily or longer bar is always in market, and so is every bar of a symbol that trades around the clock (crypto, forex, indices, futures).series<bool>
alerta.session.ispremarketsession.ispremarket → series<bool>Pine v5/v6 series<bool>: true on bars that open inside the exchange's pre-market window (04:00–09:30 New York time for a US stock). Always false for symbols without extended hours.series<bool>
alerta.session.ispostmarketsession.ispostmarket → series<bool>Pine v5/v6 series<bool>: true on bars that open inside the exchange's after-hours window (16:00–20:00 New York time for a US stock). Always false for symbols without extended hours.series<bool>
alerta.session.isfirstbarsession.isfirstbar → series<bool>Pine v5/v6 series<bool>: true on the first bar of each day's session (the exchange day time("D") uses; a forex session opens 17:00 New York), pre-market bars included; inside request.security, of the requested bars. session.isfirstbar_regular is the first regular-hours bar.series<bool>
alerta.session.islastbarsession.islastbar → series<bool>Pine v5/v6 series<bool>: true on the last bar of each day's session, post-market bars included; on the chart's last bar when the next bar would open a new day; inside request.security, of the requested bars. session.islastbar_regular is the last regular-hours bar.series<bool>
last_bar_timelast_bar_time → series intPine v6: UNIX time (ms) of the last chart bar. For closed markets this is the final historical bar; for open markets it is the realtime bar.series int
time_tradingdaytime_tradingday → series intPine v6: UNIX timestamp of 00:00 UTC of the trading day the current bar belongs to. Useful for overnight sessions where the bar may open on the previous calendar day.series int
timenowtimenow → series intPine v6: the current time in UNIX milliseconds at the moment the script runs. It does not follow the bars: every bar of one run reads the same value, and the next run reads a later one.series int
alerta.dayofweek.mondaydayofweek.sunday … dayofweek.saturday → const int (1…7)Pine v5/v6 day-of-week constants: dayofweek.sunday=1, monday=2, tuesday=3, wednesday=4, thursday=5, friday=6, saturday=7. Compare against the per-bar `dayofweek` series to gate logic to specific weekdays.const int
alerta.timeframe.main_periodtimeframe.main_period → simple stringPine v6: the CHART's timeframe period — unlike timeframe.period, this stays the chart timeframe even inside a request.security() context. timeframe.isticks is also available (always false — tick charts are not supported).simple string
alerta.session.isfirstbar_regularsession.isfirstbar_regular → series boolTrue on the first regular-hours bar of each day's session — on a stock, the first bar after the pre-market. On a symbol that trades around the clock it is the same bar as session.isfirstbar. Inside request.security, of the requested bars.series bool
alerta.session.islastbar_regularsession.islastbar_regular → series boolTrue on the last regular-hours bar of each day's session — on a stock, the last bar before the post-market. On a symbol that trades around the clock it is the same bar as session.islastbar. Inside request.security, of the requested bars.series bool
alerta.dayofweek.fridaydayofweek.friday → const intWeekday number used with dayofweek and session conditions. Use dayofweek.friday as a value, without parentheses.const int
alerta.dayofweek.saturdaydayofweek.saturday → const intWeekday number used with dayofweek and session conditions. Use dayofweek.saturday as a value, without parentheses.const int
alerta.dayofweek.sundaydayofweek.sunday → const intWeekday number used with dayofweek and session conditions. Use dayofweek.sunday as a value, without parentheses.const int
alerta.dayofweek.thursdaydayofweek.thursday → const intWeekday number used with dayofweek and session conditions. Use dayofweek.thursday as a value, without parentheses.const int
alerta.dayofweek.tuesdaydayofweek.tuesday → const intWeekday number used with dayofweek and session conditions. Use dayofweek.tuesday as a value, without parentheses.const int
alerta.dayofweek.wednesdaydayofweek.wednesday → const intWeekday number used with dayofweek and session conditions. Use dayofweek.wednesday as a value, without parentheses.const int
AlertaScript

No results found.

Search by name, alias, or keyword.