# Day Of Week

#### 15minofpham

##### New member
Would anyone know how to convert this into a scan?

Rich (BB code):
``````# Market Day Of Week

# Mobius

declare lower;
input n = 63;

def DOW = getDayOfWeek(getYYYYMMDD());

def Mon = if DOW == 1 then 1 else 0;

def Tue = if DOW == 2 then 1 else 0;

def Wed = if DOW == 3 then 1 else 0;

def Thur = if DOW == 4 then 1 else 0;

def Fri = if Dow == 5 then 1 else 0;

def Sat = if DOW == 6 then 1 else 0;

def Sun = if DOW == 7 then 1 else 0;

def Monday = fold a = 0 to n

with b

do b + getValue(Mon, a);

def MondayUp = fold c = 0 to n

with d

do d + getValue(Mon and close > open, c);

def MondayVar = MondayUp / Monday;

AddLabel(1, "Mondays: "+ Monday +

" Monday Up: " + MondayUp +

" Per Up: " + AsPercent(MondayVar),

if MondayVar > .5

then Color.Green

else Color.Red);
def Tuesday = fold aa = 0 to n

with bb

do bb + getValue(Tue, aa);

def TuesdayUp = fold cc = 0 to n

with dd

do dd + getValue(Tue and close > open, cc);

def TuesdayVar = TuesdayUp / Tuesday;

AddLabel(1, "Tuesday: "+ Tuesday +

" Tuesday Up: " + TuesdayUp +

" Per Up: " + AsPercent(TuesdayVar),

if TuesdayVar > .5

then Color.Green

else Color.Red);

def Wednesday = fold aaa = 0 to n

with bbb

do bbb + getValue(Wed, aaa);

def WednesdayUp = fold ccc = 0 to n

with ddd

do ddd + getValue(Wed and close > open, ccc);

def WedVar = WednesdayUp / Wednesday;

AddLabel(1, "Wednesday: "+ Wednesday +

" Wednesday Up: " + WednesdayUp +

" Per Up: " + AsPercent(WedVar),

if WedVar > .5

then Color.Green

else Color.Red);

def Thursday = fold aaaa = 0 to n

with bbbb

do bbbb + getValue(Thur, aaaa);

def ThursdayUp = fold cccc = 0 to n

with dddd

do dddd + getValue(Thur and close > open, cccc);

def ThursdayVar = ThursdayUp / Thursday;

AddLabel(1, "Thursday: "+ Thursday +

" Thursday Up: " + ThursdayUp +

" Per Up: " + AsPercent(ThursdayVar),

if ThursdayVar > .5

then Color.Green

else Color.Red);

def Friday = fold aaaaa = 0 to n

with bbbbb

do bbbbb + getValue(Fri, aaaaa);

def FridayUp = fold ccccc = 0 to n

with ddddd

do ddddd + getValue(Fri and close > open, ccccc);

def FridayVar = FridayUp / Friday;

AddLabel(1, "Fridays: "+ Friday +

" Fridays Up: " + FridayUp +

" Per Up: " + AsPercent(FridayVar),

if FridayVar > .5

then Color.Green

else Color.Red);

# End Code Day of Week``````

Last edited by a moderator:

#### BenTen

Staff member
Staff
VIP
@15minofpham Looks like it just plot labels on your chart. What are you trying to scan? I don't think it's possible.

Last edited:

#### 15minofpham

##### New member
Mobius said to use "Each Day == 100% of that day" for the scan portion but it doesn't work even after deleting all the "Add Label". I've tried deleting "Each Day" & "of that day" & replace with Monday, Tuesday, ect but it keeps giving me an error. I'm trying to scan for the best returns on Mon, Tues, Wed etc for day trading purposes.

#### Attachments

• Y7IfAFp.png
20 KB · Views: 4
Last edited:

### Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
314 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• Add-ons and resources
• 1 full year of unlimited support

### Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?