Skip to content
Algo Trade Analytics Docs

hour - Pine Script Variable

Current bar hour in exchange timezone.

int

series

  • Returns the hour based on the bar’s opening time in the exchange timezone.
  • Combine with minute and second when building session filters or time gates.
//@version=6
indicator("Opening hour highlight", overlay=true)
openHour = input.int(9, "Open hour")
isOpenHour = hour == openHour
bgcolor(isOpenHour ? color.new(color.green, 90) : na)