weekofyear - Pine Script Variable
weekofyear
Section titled “weekofyear”Overview
Section titled “Overview”The week number of the year, in the exchange time zone, calculated from the bar’s opening UNIX timestamp.
intQualifier
Section titled “Qualifier”series
Remarks
Section titled “Remarks”- Overnight sessions can report the previous calendar week on the first bar of the trading day.
- This variable always references the week number corresponding to the bar’s opening time. Consequently, for symbols with overnight sessions (e.g., “EURUSD”, where the “Monday” session starts on Sunday at 17:00 in exchange time), the value may represent a previous calendar week rather than the week of the session’s primary trading day.
Example
Section titled “Example”//@version=6indicator("Week number label", overlay=true, max_labels_count=1)
if barstate.islast label.new(bar_index, high, str.tostring(weekofyear), style=label.style_label_down)