An integer day-of-week index for the current bar (for example Monday=1 through Friday=5). The same value repeats for every bar that shares the same calendar day.
Reports which weekday the current bar falls on, as a number (for example Monday through Friday). Traders use it to turn rules on or off depending on the day.
How it works
For each bar it reads the bar's timestamp and returns the day-of-week index. Nothing about price is involved — it only looks at the calendar day of the bar being processed.
Connects to
Feeds into
Examples
Filter: block new entries on Mondays by checking the day-of-week index against the Monday value.
Compare the weekday index with condition.compare eq to allow signals only on a chosen day.
Common mistakes
Assuming a fixed numbering scheme — confirm whether the index starts at 0 or 1 and whether weekends are included before hard-coding a value.
Forgetting that the index is set by the bar's timestamp, so a broker time zone shift can move bars across a day boundary.