Skip to content

minute() - Pine Script Function

minute() extracts the minute (0–59) from a UNIX timestamp. By default it uses the symbol’s exchange timezone (syminfo.timezone), but you can supply your own offset or IANA timezone string to align with a different market session.

minute(time, timezone) → series int
NameTypeDescription
timeseries intUNIX timestamp in milliseconds. Most scripts pass the built-in time series or values returned by request.security().
timezoneseries string (optional)Target timezone in "UTC±HH[:MM]" format or an IANA name like "America/New_York". Defaults to syminfo.timezone.

series int — Minute component in the requested timezone.

  • minute() operates on the timestamp at the open of each bar. On markets with overnight sessions, the returned value reflects the session start time.
  • Combine with hour() or second() for more precise scheduling, or with time(timeframe.period, session) to test custom sessions.
  • When timezone is supplied, Pine performs the conversion per bar, so the function remains safe to use with request.security() results from foreign exchanges.
//@version=5
indicator("NY opening range highlight", overlay=true)
// Convert the bar timestamp to Eastern Time (falls back to EST/EDT automatically).
nyHour = hour(time, "America/New_York")
nyMinute = minute(time, "America/New_York")
isOpeningRange = nyHour == 9 and nyMinute < 30
bgcolor(isOpeningRange ? color.new(color.orange, 85) : na,
title="Highlight the first 30 minutes after the NY open")
plot(close, "Close", color=color.gray)