Skip to content
Algo Trade Analytics Docs
Pine library page — review pending. This page is preserved for compatibility but is not part of the reviewed search index. Check the official Pine Script v6 reference before relying on its explanation, signature, or example.

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)