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

[amibroker] Sunday to Thursday week



PureBytes Links

Trading Reference Links

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

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