Day Of Week

1

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

BenTen

Administrative
Staff
VIP
Warehouse
@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:
1

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.



 
Last edited:

Top