DAYOFWEEK - day of week Date/Time (AFL 1.4)
SYNTAX dayofweek() RETURNS ARRAY FUNCTION Returns the array with day of week (0-6): 0 - Sunday 1 - Monday ... 5 - Friday 6- Saturday EXAMPLE buy = dayofweek() == 1; // buy on Monday sell = dayofweek() == 5; // sell on Friday SEE ALSO References: --- -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] Behalf Of Tamer Gamal Sent: Monday, June 04, 2007 11:00 AM To: [email protected] Subject: [amibroker] Sunday to Thursday week Dear All, Can anyone help me change the below formula from (Mon to Firday) week to (Sunday to Thursday) week. Your Help is highly appriciated. thx in advance --------------------------------------------------------------------- firstday = ValueWhen( Cum(1)==1, DayOfWeek() ); numweeks = IIf(LastValue(DayOfWeek())==firstday, LastValue(Cum(DayOfWeek()==firstday)),LastValue(Cum(DayOfWeek() ==firstday))+1 ); numweek = IIf(firstday==1, Cum( DayOfWeek() < Ref(DayOfWeek(),-1) ), IIf(firstday>1, Cum( DayOfWeek() < Ref(DayOfWeek(),-1) )+1 , 0 )); numweek = IIf(IsEmpty(numweek),1,numweek); firstbar = LastValue(Cum(1))-LastValue(numweek)+1; dayRef = 5-LastValue(DayOfWeek()) + 4*( Cum(1) - LastValue(Cum(1)) ); xxx = Min(0,5-LastValue(DayOfWeek()) + 4*( Cum(1) - LastValue(Cum (1)) )); wo = IIf(IsEmpty( Ref(DayOfWeek(),-DayOfWeek()) ), ValueWhen(DayOfWeek()==firstday,O), ValueWhen(DayOfWeek()==1,O ) ); wh = HHV(H,Min(DayOfWeek(),5)); wl = LLV(L,Min(DayOfWeek(),5)); wc = C; weeko =Ref(wo,xxx); weekh = Ref(wh,xxx); weekl = Ref(wl,xxx); weekc = Ref(wc,xxx); PlotOHLC(weeko,weekh,weekl,weekc,"weekly",colorBlack,styleCandle); ------------------------------------------------------------------- Please note that this group is for discussion between users only. To get support from AmiBroker please send an e-mail directly to SUPPORT {at} amibroker.com For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: http://www.amibroker.com/devlog/ For other support material please check also: http://www.amibroker.com/support.html Yahoo! Groups Links
