OpenDayOfWeek
OpenDayOfWeek returns the weekday (1 Monday to 7 Sunday) on which the current bar opened in ProBuilder. Use it for day-of-week filters in trading systems.
Syntax
OpenDayOfWeekHow it works
OpenDayOfWeek reads the opening timestamp of the current bar and returns its weekday as an integer, with 1 corresponding to Monday and 7 to Sunday. The keyword takes no parameters.
It belongs to the Open family of date and time keywords, which describe when a bar opened. The bare sibling DayOfWeek follows the bar's closing date instead. For most intraday bars both report the same weekday, but bars that span midnight, and weekly bars in general, can open and close on different weekdays.
Weekday filters are a common structural element in automated systems. Some markets show distinct behavior around the weekly open or close, and some strategies simply avoid days with recurring scheduled events. OpenDayOfWeek expresses such rules in a single comparison, without any date arithmetic.
The numbering convention differs between references and between day-of-week keywords, so it is worth confirming the mapping empirically before relying on it, for example by returning the raw value from a small indicator and checking it against the chart.
Examples
Example 1, Detect bars opening on a Monday (Indicator)
// Flag bars that opened on a Monday (weekday 1)
if OpenDayOfWeek = 1 then
// logic for bars opening the week
mondayOpen = 1
else
mondayOpen = 0
endif
RETURN mondayOpenThe indicator plots 1 on bars that opened on a Monday, marking the start of each trading week directly on the chart.
Example 2, Skip Friday entries (ProOrder)
// Take breakout entries except on bars opening on Friday (weekday 5)
notFriday = OpenDayOfWeek <> 5
IF notFriday AND close CROSSES OVER Highest[20](close[1]) THEN
BUY 1 SHARES AT MARKET
ENDIFThe system takes 20-bar breakouts on any weekday except Friday, avoiding positions opened just before the weekend gap risk.
Example 3, Screen for midweek strength (ProScreener)
// Match instruments above their weekly-open average on Wednesdays
midweek = OpenDayOfWeek = 3
strong = close > Average[20](close)
SCREENER[midweek AND strong] (OpenDayOfWeek AS "Weekday")The screener returns instruments meeting the strength condition only on bars that opened on a Wednesday, displaying the weekday number in the results.
Common errors and gotchas
- Open weekday versus close weekday. OpenDayOfWeek follows the bar's opening date. The sibling
DayOfWeekfollows the closing date, and the two can differ on bars spanning midnight or on weekly bars. - Verify the numbering. This reference lists 1 (Monday) through 7 (Sunday), while other day-of-week keywords in ProRealTime™ are commonly documented as 0 (Sunday) through 6 (Saturday). Confirm the mapping with a
RETURN OpenDayOfWeektest before hardcoding weekday numbers. - Weekend values rarely occur. On most instruments no bars open on Saturday or Sunday, so conditions on values 6 or 7 never fire. Crypto and some futures sessions are exceptions.
- True for the whole day. On intraday charts every bar of a given session reports the same opening weekday. Combine with an hour or transition condition to trigger an action once per day.
Related instructions
DayOfWeek, weekday of a bar's closing date, the sibling form of OpenDayOfWeek.CurrentDayOfWeek, weekday of the machine clock rather than a bar timestamp.OpenDay, day of the month on which the current bar opened.OpenHour, hour at which the current bar opened.OpenDate, full opening date of the current bar in YYYYMMDD format.Day, day of the month of a bar's closing date.Today, date of the current bar in YYYYMMDD format.
