And here's the WMA version.
{Weekly ALM Custom ROC} {2005
Roy Larsen, www.metastocktips.co.nz}
{for use on daily charts with Jose Silva's "Calendar Week
counter"} F:=Input("End of Week, 5=Friday 6=Saturday
7=Sunday",5,7,5); Q:=Input("Display Mode, 0=Static
1=Dynamic 2=Test",0,2,1); {0=Display, update on Friday (when
possible)} {1=Display, update on each new bar} {2=Backtest,
update on first bar of new
week} G:=LastValue(Highest(Sum(DayOfWeek()=F,5))=5); I:=Fml("Calendar Week
counter"); I:={Abs}(I-ValueWhen(2-G,1,I)); M:=G OR I>0; F:=G OR
(DayOfWeek()=F AND
I=0); A:=LastValue(Cum(1)-1)=Cum(1); B:=ValueWhen(2,1,A); J:=If(F,1,If(Alert(F,2)=0
AND M,2,0)); J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J); J:=If(G,1,If(Q=2
OR
Cum(J)<=1,M*2,J)); K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C))); R1:=ValueWhen(81,J,K);
R1:=(K-R1)/R1; R2:=ValueWhen(12,J,K); R2:=(K-R2)/R2;
Y:=R1+R2; (ValueWhen(11,J,Y)+ValueWhen(10,J,Y)*2+ ValueWhen(9,J,Y)*3+ValueWhen(8,J,Y)*4+ ValueWhen(7,J,Y)*5+ValueWhen(6,J,Y)*6+ ValueWhen(5,J,Y)*7+ValueWhen(4,J,Y)*8+ ValueWhen(3,J,Y)*9+ValueWhen(2,J,Y)*10+Y*11)/66;
----- Original Message -----
Sent: Tuesday, June 21, 2005 12:00 PM
Subject: Re: [EquisMetaStock Group] Plotting Weekly Values of
indicator on daily chart - need you help, Roy!
Hi ALM
This is what your custom formula would look like
using a simple moving average.
{Weekly ALM Custom ROC} {2005 Roy
Larsen, www.metastocktips.co.nz}
{for use on daily charts with Jose Silva's "Calendar Week
counter"} F:=Input("End of Week, 5=Friday 6=Saturday
7=Sunday",5,7,5); Q:=Input("Display Mode, 0=Static
1=Dynamic 2=Test",0,2,1); {0=Display, update on Friday (when
possible)} {1=Display, update on each new bar} {2=Backtest,
update on first bar of new
week} G:=LastValue(Highest(Sum(DayOfWeek()=F,5))=5); I:=Fml("Calendar Week
counter"); I:={Abs}(I-ValueWhen(2-G,1,I)); M:=G OR I>0; F:=G OR
(DayOfWeek()=F AND
I=0); A:=LastValue(Cum(1)-1)=Cum(1); B:=ValueWhen(2,1,A); J:=If(F,1,If(Alert(F,2)=0
AND M,2,0)); J:=If(A+LastValue(J)>2 OR B+(Q=1)=2,1,J); J:=If(G,1,If(Q=2
OR
Cum(J)<=1,M*2,J)); K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C))); R1:=ValueWhen(81,J,K);
R1:=(K-R1)/R1; R2:=ValueWhen(12,J,K); R2:=(K-R2)/R2;
X:=Cum((R1+R2)*(J>0)); (X-ValueWhen(12,J,X))/11;
----- Original Message -----
Sent: Monday, June 20, 2005 5:36 PM
Subject: [EquisMetaStock Group] Plotting Weekly Values of indicator
on daily chart - need you help, Roy!
I have created the following indicator (called "osc1")
with the following codes …
osc1:=Mov(ROC(C,80,%)+ROC(C,11,%),10,W);
Now, I wish to be able to
view the chart showing the price chart in daily periodicity BUT with the
WEEKLY values of the indicator (osc1) on the same daily chart.
I know
Roy has written some codes for many indicators designed to plot weekly
values on daily charts which are to be used in conjunction with Jose Silva's
"Calendar Week counter" but I have problem trying. Roy, do you think you can
help me out?
Many thanks and best
regards, ALM
Yahoo! Groups Links
|