The day of the week of the current bar's open time, from 1 for Sunday to 7 for Saturday.
dayofweek is a series int. Sunday is 1 and Saturday is 7, the same numbers as the dayofweek.sunday to dayofweek.saturday constants, so write dayofweek == dayofweek.monday rather than a bare 2.
Type
series int
Remarks
- dayofweek[n] is na before the first bar.
- The weekday is read in the exchange time zone, so an overnight futures session that opens on Sunday evening has dayofweek 1 on those bars.
- On Sidechair: the parts are read in the symbol's exchange time zone, the same as
syminfo.timezone.
Example
//@version=6
indicator("Mondays", overlay = true)
isMonday = dayofweek == dayofweek.monday
bgcolor(isMonday ? color.new(color.blue, 90) : na)
plot(dayofweek, "Weekday", display = display.data_window)See also
Runs on Sidechair