1

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.

user3848207
  • 3,737
  • 17
  • 59
  • 104

1 Answers1

1

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")
mr_statler
  • 1,913
  • 2
  • 3
  • 14