I have a variable, WeeklySum, that I am running every Friday with Amiquote on 
Yahoo mutual fund data to get a sum of the past 26 weeks of closes. (I then 
divide by 26 to get an average.) However, some weeks only consist of four 
trading days and so my calculations are off when comparing my 5-day numbers to 
the actual weekly closes listed on Yahoo's historical quotes page. I am trying 
to figure out how to use dayofweek() to only get the Friday close. I understand 
that dayofweek() == 5 but do not know how to change my formula below to work 
with Friday data. Any  help appreciated. 

WeeklySum = C + Ref( C, -5 ) + Ref( C, -10 ) + Ref( C, -15 ) + Ref( C, -20 ) + 
Ref( C, -25 ) + Ref( C, -30 ) + Ref( C, -35 ) + Ref( C, -40 ) + Ref( C, -45 ) + 
Ref( C, -50 ) + Ref( C, -55 ) + Ref( C, -60 ) + Ref( C, -65 ) + Ref( C, -70 ) + 
Ref( C, -75 ) + Ref( C, -80 ) + Ref( C, -85 ) + Ref( C, -90 ) + Ref( C, -95 ) + 
Ref( C, -100 ) + Ref( C, -105 ) + Ref( C, -110 ) + Ref( C, -115 ) + Ref( C, 
-120 ) + Ref( C, -125 );


Reply via email to