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

RE: [amibroker] Sunday to Thursday week



PureBytes Links

Trading Reference Links

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: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]On Behalf
Of Tamer Gamal
Sent: Monday, June 04, 2007 11:00 AM
To: amibroker@xxxxxxxxxxxxxxx
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






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

<*> 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/