Skip to content
StatePath
Tool Atlastime.hour_of_day

Tool

Hour of Day

time.hour_of_day

MarketTime

Inputs

No typed inputs.

Outputs

Buffer (time series)

An integer hour of the day (0–23) for the current bar. Every bar within the same clock hour returns the same value.

Reports the hour (0–23) of the current bar's timestamp. Traders use it to restrict activity to specific hours or trading sessions.

Hour of Day overview diagram00:0008:0014:0024:00

How it works

For each bar it reads the timestamp and returns the hour component, 0 through 23. It ignores price entirely and simply tells you what time of day the bar belongs to.

Modes

UTCUTC

Read the hour on the UTC wall clock.

UTC diagram00:0008:0014:0024:00
Europe/Athens (feed clock)Europe/Athens

Read the hour on the feed clock (Europe/Athens), the zone the data source writes its bars on.

Europe/Athens (feed clock) diagram00:0008:0014:0024:00
Europe/LondonEurope/London

Read the hour on the Europe/London wall clock.

Europe/London diagram00:0008:0014:0024:00
America/New_YorkAmerica/New_York

Read the hour on the America/New_York wall clock.

America/New_York diagram00:0008:0014:0024:00
Asia/TokyoAsia/Tokyo

Read the hour on the Asia/Tokyo wall clock.

Asia/Tokyo diagram00:0008:0014:0024:00

Configuration

timezoneenum

The wall clock the hour is read on: UTC by default, the feed clock (Europe/Athens, the zone the data source writes its bars on) or a session's own zone. An hour window written for London belongs on Europe/London.

Choices:UTCEurope/AthensEurope/LondonAmerica/New_YorkAsia/Tokyo

Connects to

Feeds into

Examples

  • Filter: only allow entries between 08:00 and 16:00 by passing the hour into condition.compare (3-operand le).
  • Use condition.compare gt on the hour to avoid trading before a chosen morning hour.

Common mistakes

  • Reading the hour on the wrong clock: it is read on the node's timezone (UTC by default), so pick the zone your session hours are written in.
  • Building an hour window that wraps past midnight (for example 22–2) with a single in_range check — that range is non-contiguous and needs two checks.

See also