Skip to content

DAYOFWEEK() Function

By Optuma Team · Updated 2019-09-19

The Day of Week function (available from Optuma v1.5 or higher) allows you to reference specific days of the week in your scripts. Each Day is assigned a numerical value:

1 = Sunday
2 = Monday
3 = Tuesday
4 = Wednesday
5 = Thursday
6 = Friday
7 = Saturday

On a show view the base function DAYOFWEEK() would produce the following result:

Dayofweek

You can see the script value oscillates between 1 and 7 based on the day.

The following example looks for the Closing price crossing above a 150EMA, but only if it occurs on a Monday:

V1 = DAYOFWEEK() == 2;
V2 = CLOSE() CrossesAbove MA(BARS=150, STYLE=Exponential) ;
V1 and V2

On a chart the script would look like this:

Example

The blue bar shows where the scripted criteria has passed. You can see the close also crossed above the 150EMA on the 29th of November, but as it was not a Monday the script did not pass.

Choose which categories of cookies you allow. Strictly-necessary cookies are always on. You can change this any time via the "Cookie Settings" link in the footer.

  • Functional

    Remember preferences like dismissed banners and your dark-mode choice.

  • Analytics

    Help us understand how the site is used so we can improve it.

  • Marketing

    Measure our advertising and help us reach people who may be interested in Optuma.