[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Question about how to use dayofweek() to sum up weekly closes for past 26 weeks



PureBytes Links

Trading Reference Links

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 );




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/