Reputation: 4917
The built-in variable hour
in pine script refers to the hour in the exchange's timezone. I would like to have a variable called UTC_hour
to refer to UTC timezone.
I am using pinescript v5.
Upvotes: 2
Views: 2299
Reputation: 2161
The hour()
function has a timezone
parameter:
timezone (series string) Allows adjusting the returned value to a time zone specified in either UTC/GMT notation (e.g., "UTC-5", "GMT+0530") or as an IANA time zone database name (e.g., "America/New_York"). Optional. The default is syminfo.timezone.
You can use it like this to get the current bar time in UTC timezone:
hour(time, "UTC")
Upvotes: 3