========
Contents
========
WeekCount.txt - Calendar Week counter
Roy-50.txt - Weekly ADX
Roy-51.txt - Weekly ATR
Roy-52.txt - Weekly BB Bottom
Roy-53.txt - Weekly BB Top
Roy-54.txt - Weekly Bollinger Bands
Roy-55.txt - Weekly Close
Roy-56.txt - Weekly CMO
Roy-57.txt - Weekly Double Smoothed Stochastic
Roy-58.txt - Weekly EMA - Close
Roy-59.txt - Weekly Fractal Down
Roy-60.txt - Weekly Fractal Up
Roy-61.txt - Weekly Linear Regression Slope
Roy-62.txt - Weekly Linear Regression
Roy-63.txt - Weekly MACD - Close
Roy-64.txt - Weekly Momentum
Roy-65.txt - Weekly OHLC
Roy-66.txt - Weekly RSI - Close
Roy-67.txt - Weekly SMA - Close
Roy-68.txt - Weekly SMA - High
Roy-69.txt - Weekly SMA - Low
Roy-70.txt - Weekly SMA - Open
Roy-71.txt - Weekly Standard Deviation
Roy-72.txt - Weekly Stochastic Oscillator EMA
Roy-73.txt - Weekly Stochastic Oscillator SMA
Roy-74.txt - Weekly Timing Signals
Roy-75.txt - Weekly Volume
Roy-76.txt - Weekly Wilders - Close
MetaStock -> Tools -> Indicator Builder -> New
Copy and paste formulae below.
=====================
Calendar Week counter
=====================
The "Calendar Week counter" is a prerequisite for all
of the following weekly indicators.
---8<---------------------------
{Week counter v2.0, Gregorian calendar}
{Count is independent of any missing chart data}
{©Copyright 2003-2004 Jose Silva}
{http://www.metastocktools.com}
limit:=2000; {do not change limit year}
LimLeap:=Frac(limit/4)=0 AND Frac(limit/100)<>0
OR Frac(limit/400)=0;
NoCount:=limit*365+Int(limit/4)
-Int(limit/100)+Int(limit/400)-LimLeap;
leap:=Frac(Year()/4)=0 AND Frac(Year()/100)<>0
OR Frac(Year()/400)=0;
y:=Year()*365+Int(Year()/4)
-Int(Year()/100)+Int(Year()/400)-NoCount;
m:=
If(Month()=2,31-leap,
If(Month()=3,59,
If(Month()=4,90,
If(Month()=5,120,
If(Month()=6,151,
If(Month()=7,181,
If(Month()=8,212,
If(Month()=9,243,
If(Month()=10,273,
If(Month()=11,304,
If(Month()=12,334,
-leap)))))))))));
DayNr:=y+m+DayOfMonth();
WkCount:=Int((DayNr-1)/7)+(Year()>=limit);
WkCount
---8<---------------------------
==========
Weekly ADX
==========
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly ADX" plots a weekly ADX signal on any daily chart.
The construction is not quite true to the standard MetaStock
"Directional Movement ADX" indicator and therefore the plot values
also will differ slightly.
---8<---------------------------
{Weekly ADX}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
N:=Input("Weekly ADX Periods",1,99,10); X:=1/N;
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,2);
{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:=LastValue(Cum(1))=Cum(1);
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));
Ho:=HighestSince(1,M,H);
Ho:=ValueWhen(1,J,If(J=1,Ho,ValueWhen(2-G,1,Ho)));
Lo:=LowestSince(1,M,L);
Lo:=ValueWhen(1,J,If(J=1,Lo,ValueWhen(2-G,1,Lo)));
Ci:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
Ho:=ValueWhen(1,Ho>0,Ho); Hi:=ValueWhen(2,J,Ho);
Lo:=ValueWhen(1,Lo>0,Lo); Li:=ValueWhen(2,J,Lo);
Ci:=ValueWhen(1,Ci>0,Ci); Ci:=ValueWhen(2,J,Ci);
Pdm:=If(Ho>Hi AND Lo>=Li,Ho-Hi,If(Ho>Hi AND
Lo
(Li-Lo),Ho-Hi,0));
Mdm:=If(LoHi AND
Lo0)0)*R)/N, ValueWhen(1,J,PREV)*(1-X)+R*X);
I:=If(Cum(J>0)0)*Pdm)/N, ValueWhen(1,J,PREV)*(1-X)+Pdm*X);
I:=100*I/A;
M:=If(Cum(J>0)0)*Mdm)/N, ValueWhen(1,J,PREV)*(1-X)+Mdm*X);
M:=100*M/A;
M:=Abs(I-M)/(I+M);
F:=ValueWhen(1,J,PREV)*(1-X)+M*X;
100*If(ValueWhen(N+1,J,F)>0,F,F);
---8<---------------------------
==========
Weekly ATR
==========
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly ATR" plots a weekly ATR signal on any daily chart.
---8<---------------------------
{Weekly ATR}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
N:=Input("Weekly ATR Periods",1,99,10); X:=1/N;
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,2);
{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:=LastValue(Cum(1))=Cum(1);
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));
Ho:=HighestSince(1,M,H);
Ho:=ValueWhen(1,J,If(J=1,Ho,ValueWhen(2-G,1,Ho)));
Lo:=LowestSince(1,M,L);
Lo:=ValueWhen(1,J,If(J=1,Lo,ValueWhen(2-G,1,Lo)));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
Ho:=ValueWhen(1,Ho>0,Ho); Hi:=ValueWhen(2,J,Ho);
Lo:=ValueWhen(1,Lo>0,Lo); Li:=ValueWhen(2,J,Lo);
K:=ValueWhen(1,K>0,K); Ci:=ValueWhen(2,J,K);
R:=Max(Max(Abs(Ci-Lo),Abs(Ci-Ho)),Ho-Lo);
A:=If(Cum(J>0)0)*R)/N, ValueWhen(1,J,PREV)*(1-X)+R*X);
If(ValueWhen(N+1,J,A)>0,A,A);
---8<---------------------------
================
Weekly BB Bottom
================
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly BB Bottom" plots a weekly Bollinger Band Bottom signal
on any daily chart.
---8<---------------------------
{Weekly BB Bottom}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
N:=Input("Weekly BB Bottom Periods",1,30,20);
D:=Input("Standard Deviations",0,9,1);
Ma:=Input("Base Average, 0=SMA 1=EMA",0,1,0);
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,2);
{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:=LastValue(Cum(1))=Cum(1);
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)));
K:=ValueWhen(1,K>0,K); Y:=2/(N+1);
M:=(Cum(If(J,K,0))-ValueWhen(N+1,J,Cum(If(J,K,0))))/N;
Me:=If(Cum(J>0)=1,K,ValueWhen(1,J,PREV)*(1-Y)+K*Y);
N1:=LastValue((N>10)*10); N2:=LastValue((N>20)*20);
X:=Power(M-ValueWhen(1,J,K),2)+
(N>1)*Power(M-ValueWhen(2,J,K),2)+
(N>2)*Power(M-ValueWhen(3,J,K),2)+
(N>3)*Power(M-ValueWhen(4,J,K),2)+
(N>4)*Power(M-ValueWhen(5,J,K),2)+
(N>5)*Power(M-ValueWhen(6,J,K),2)+
(N>6)*Power(M-ValueWhen(7,J,K),2)+
(N>7)*Power(M-ValueWhen(8,J,K),2)+
(N>8)*Power(M-ValueWhen(9,J,K),2)+
(N>9)*Power(M-ValueWhen(10,J,K),2)+
(N>10)*Power(M-ValueWhen(N1+1,J,K),2)+
(N>11)*Power(M-ValueWhen(N1+2,J,K),2)+
(N>12)*Power(M-ValueWhen(N1+3,J,K),2)+
(N>13)*Power(M-ValueWhen(N1+4,J,K),2)+
(N>14)*Power(M-ValueWhen(N1+5,J,K),2)+
(N>15)*Power(M-ValueWhen(N1+6,J,K),2)+
(N>16)*Power(M-ValueWhen(N1+7,J,K),2)+
(N>17)*Power(M-ValueWhen(N1+8,J,K),2)+
(N>18)*Power(M-ValueWhen(N1+9,J,K),2)+
(N>19)*Power(M-ValueWhen(N1+10,J,K),2)+
(N>20)*Power(M-ValueWhen(N2+1,J,K),2)+
(N>21)*Power(M-ValueWhen(N2+2,J,K),2)+
(N>22)*Power(M-ValueWhen(N2+3,J,K),2)+
(N>23)*Power(M-ValueWhen(N2+4,J,K),2)+
(N>24)*Power(M-ValueWhen(N2+5,J,K),2)+
(N>25)*Power(M-ValueWhen(N2+6,J,K),2)+
(N>26)*Power(M-ValueWhen(N2+7,J,K),2)+
(N>27)*Power(M-ValueWhen(N2+8,J,K),2)+
(N>28)*Power(M-ValueWhen(N2+9,J,K),2)+
(N>29)*Power(M-ValueWhen(N2+10,J,K),2);
Ma:=If(Ma,Me,M); Sd:=D*Sqrt(X/N);
Ma-Sd;
---8<---------------------------
=============
Weekly BB Top
=============
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly BB Top" plots a weekly Bollinger Band Top signal
on any daily chart.
---8<---------------------------
{Weekly BB Top}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
N:=Input("Weekly BB Top Periods",1,30,20);
D:=Input("Standard Deviations",0,9,1);
Ma:=Input("Base Average, 0=SMA 1=EMA",0,1,0);
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,2);
{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:=LastValue(Cum(1))=Cum(1);
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)));
K:=ValueWhen(1,K>0,K); Y:=2/(N+1);
M:=(Cum(If(J,K,0))-ValueWhen(N+1,J,Cum(If(J,K,0))))/N;
Me:=If(Cum(J>0)=1,K,ValueWhen(1,J,PREV)*(1-Y)+K*Y);
N1:=LastValue((N>10)*10); N2:=LastValue((N>20)*20);
X:=Power(M-ValueWhen(1,J,K),2)+
(N>1)*Power(M-ValueWhen(2,J,K),2)+
(N>2)*Power(M-ValueWhen(3,J,K),2)+
(N>3)*Power(M-ValueWhen(4,J,K),2)+
(N>4)*Power(M-ValueWhen(5,J,K),2)+
(N>5)*Power(M-ValueWhen(6,J,K),2)+
(N>6)*Power(M-ValueWhen(7,J,K),2)+
(N>7)*Power(M-ValueWhen(8,J,K),2)+
(N>8)*Power(M-ValueWhen(9,J,K),2)+
(N>9)*Power(M-ValueWhen(10,J,K),2)+
(N>10)*Power(M-ValueWhen(N1+1,J,K),2)+
(N>11)*Power(M-ValueWhen(N1+2,J,K),2)+
(N>12)*Power(M-ValueWhen(N1+3,J,K),2)+
(N>13)*Power(M-ValueWhen(N1+4,J,K),2)+
(N>14)*Power(M-ValueWhen(N1+5,J,K),2)+
(N>15)*Power(M-ValueWhen(N1+6,J,K),2)+
(N>16)*Power(M-ValueWhen(N1+7,J,K),2)+
(N>17)*Power(M-ValueWhen(N1+8,J,K),2)+
(N>18)*Power(M-ValueWhen(N1+9,J,K),2)+
(N>19)*Power(M-ValueWhen(N1+10,J,K),2)+
(N>20)*Power(M-ValueWhen(N2+1,J,K),2)+
(N>21)*Power(M-ValueWhen(N2+2,J,K),2)+
(N>22)*Power(M-ValueWhen(N2+3,J,K),2)+
(N>23)*Power(M-ValueWhen(N2+4,J,K),2)+
(N>24)*Power(M-ValueWhen(N2+5,J,K),2)+
(N>25)*Power(M-ValueWhen(N2+6,J,K),2)+
(N>26)*Power(M-ValueWhen(N2+7,J,K),2)+
(N>27)*Power(M-ValueWhen(N2+8,J,K),2)+
(N>28)*Power(M-ValueWhen(N2+9,J,K),2)+
(N>29)*Power(M-ValueWhen(N2+10,J,K),2);
Ma:=If(Ma,Me,M); Sd:=D*Sqrt(X/N);
Ma+Sd;
---8<---------------------------
======================
Weekly Bollinger Bands
======================
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly Bollinger Bands" plots weekly Bollinger Band signals
on any daily chart.
---8<---------------------------
{Weekly Bollinger Bands}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
N:=Input("Weekly Bollinger Band Periods",1,30,20);
D:=Input("Standard Deviations",0,9,2);
Ma:=Input("Base Average, 0=SMA 1=EMA",0,1,0);
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,2);
{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:=LastValue(Cum(1))=Cum(1);
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)));
K:=ValueWhen(1,K>0,K); Y:=2/(N+1);
M:=(Cum(If(J,K,0))-ValueWhen(N+1,J,Cum(If(J,K,0))))/N;
Me:=If(Cum(J>0)=1,K,ValueWhen(1,J,PREV)*(1-Y)+K*Y);
N1:=LastValue((N>10)*10);
N2:=LastValue((N>20)*20);
X:=Power(M-ValueWhen(1,J,K),2)+
(N>1)*Power(M-ValueWhen(2,J,K),2)+
(N>2)*Power(M-ValueWhen(3,J,K),2)+
(N>3)*Power(M-ValueWhen(4,J,K),2)+
(N>4)*Power(M-ValueWhen(5,J,K),2)+
(N>5)*Power(M-ValueWhen(6,J,K),2)+
(N>6)*Power(M-ValueWhen(7,J,K),2)+
(N>7)*Power(M-ValueWhen(8,J,K),2)+
(N>8)*Power(M-ValueWhen(9,J,K),2)+
(N>9)*Power(M-ValueWhen(10,J,K),2)+
(N>10)*Power(M-ValueWhen(N1+1,J,K),2)+
(N>11)*Power(M-ValueWhen(N1+2,J,K),2)+
(N>12)*Power(M-ValueWhen(N1+3,J,K),2)+
(N>13)*Power(M-ValueWhen(N1+4,J,K),2)+
(N>14)*Power(M-ValueWhen(N1+5,J,K),2)+
(N>15)*Power(M-ValueWhen(N1+6,J,K),2)+
(N>16)*Power(M-ValueWhen(N1+7,J,K),2)+
(N>17)*Power(M-ValueWhen(N1+8,J,K),2)+
(N>18)*Power(M-ValueWhen(N1+9,J,K),2)+
(N>19)*Power(M-ValueWhen(N1+10,J,K),2)+
(N>20)*Power(M-ValueWhen(N2+1,J,K),2)+
(N>21)*Power(M-ValueWhen(N2+2,J,K),2)+
(N>22)*Power(M-ValueWhen(N2+3,J,K),2)+
(N>23)*Power(M-ValueWhen(N2+4,J,K),2)+
(N>24)*Power(M-ValueWhen(N2+5,J,K),2)+
(N>25)*Power(M-ValueWhen(N2+6,J,K),2)+
(N>26)*Power(M-ValueWhen(N2+7,J,K),2)+
(N>27)*Power(M-ValueWhen(N2+8,J,K),2)+
(N>28)*Power(M-ValueWhen(N2+9,J,K),2)+
(N>29)*Power(M-ValueWhen(N2+10,J,K),2);
Ma:=If(Ma,Me,M); Sd:=D*Sqrt(X/N);
Ma; {moving average}
Ma+Sd; {Bollinger Band Top}
Ma-Sd; {Bollinger Band Bottom}
---8<---------------------------
============
Weekly Close
============
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly Close" plots a weekly closing price on any daily chart.
---8<---------------------------
{Weekly Close}
{© 2004 Roy Larsen, rlarsen@man.quik.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,2);
{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:=LastValue(Cum(1))=Cum(1);
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)));
K:=ValueWhen(1,K>0,K);
K;
---8<---------------------------
==========
Weekly CMO
==========
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly CMO" plots a weekly Chande Momentum Oscillator signal
on any daily chart.
---8<---------------------------
{Weekly CMO}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
N:=Input("Weekly CMO Periods ",1,99,10);
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,2);
{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:=LastValue(Cum(1))=Cum(1);
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)));
K:=ValueWhen(1,K>0,K);
K1:=ValueWhen(2,J>0,K);
Uw:=If(K>K1,K-K1,0);
Dw:=If(K0,Uw,0))-ValueWhen(N+1,J,Cum(If(J,Uw,0)));
D:=Cum(If(J>0,Dw,0))-ValueWhen(N+1,J,Cum(If(J,Dw,0)));
100*(U-D)/(U+D);
---8<---------------------------
=================================
Weekly Double Smoothed Stochastic
=================================
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly Double Smoothed Stochastic" plots a weekly double
smoothed Stochastic Oscillator signal on any daily chart.
---8<---------------------------
{Weekly Double Smoothed Stochastic}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
N:=Input("Weekly Double Smoothed Stochastic Periods",2,99,10);
R:=Input("Smoothing Periods",1,9,3);
R:=2/(R+1);
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,2);
{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:=LastValue(Cum(1))=Cum(1);
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));
Hw:=HighestSince(1,M,H);
Hw:=ValueWhen(1,J,If(J=1,Hw,ValueWhen(2-G,1,Hw)));
Lw:=LowestSince(1,M,L);
Lw:=ValueWhen(1,J,If(J=1,Lw,ValueWhen(2-G,1,Lw)));
K:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
Ls:=LowestSince(N,J,Lw);
Hs:=HighestSince(N,J,Hw);
P0:=((K-Ls)/(Hs-Ls))*100;
P1:=ValueWhen(1,J,PREV)*(1-R)+P0*R;
Lp:=LowestSince(N,J,P1);
Hp:=HighestSince(N,J,P1);
P2:=((P1-Lp)/(Hp-Lp))*100;
ValueWhen(1,J,PREV)*(1-R)+P2*R;
---8<---------------------------
==================
Weekly EMA - Close
==================
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly EMA - Close" plots a weekly exponential moving average
of the weekly closing price on any daily chart.
---8<---------------------------
{Weekly EMA - Close}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
N:=Input("Weekly EMA - Close Periods",1,99,10);
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,2);
{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:=LastValue(Cum(1))=Cum(1);
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)));
N:=2/(1+N);
If(Cum(G+J>0)<=2-G,K, ValueWhen(1,J,PREV)*(1-N)+K*N);
---8<---------------------------
===================
Weekly Fractal Down
===================
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly Fractal Down" plots a weekly fractal down signal
on any daily chart.
---8<---------------------------
{Weekly Fractal Down}
{© 2004 Roy Larsen, rlarsen@man.quik.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,2);
{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:=LastValue(Cum(1))=Cum(1);
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));
L0:=LowestSince(1,M,L);
L0:=ValueWhen(1,J,If(J=1,L0,ValueWhen(2-G,1,L0)));
L1:=ValueWhen(2,J,L0);
L2:=ValueWhen(3,J,L0);
L3:=ValueWhen(4,J,L0);
L4:=ValueWhen(5,J,L0);
L5:=ValueWhen(6,J,L0);
Single:=L20;
F:=G OR (DayOfWeek()=F AND I=0);
A:=LastValue(Cum(1)-1)=Cum(1);
B:=LastValue(Cum(1))=Cum(1);
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));
H0:=HighestSince(1,M,H);
H0:=ValueWhen(1,J,If(J=1,H0,ValueWhen(2-G,1,H0)));
H1:=ValueWhen(2,J,H0);
H2:=ValueWhen(3,J,H0);
H3:=ValueWhen(4,J,H0);
H4:=ValueWhen(5,J,H0);
H5:=ValueWhen(6,J,H0);
Single:=H2>H4 AND H2>H3 AND H2>H1;
Double:=H2>H5 AND H2>H4 AND H2=H3 AND H2>H1;
ValueWhen(1,Single OR Double,H2);
---8<---------------------------
==============================
Weekly Linear Regression Slope
==============================
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly Linear Regression Slope" plots a weekly Linear
Regression Slope signal on any daily chart.
---8<---------------------------
{Weekly Linear Regression Slope}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
D:=Input("Weekly Linear Regression Slope Periods",1,99,14);
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,2);
{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:=LastValue(Cum(1))=Cum(1);
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)));
K:=ValueWhen(1,K>0,K);
M:=Cum(J>0)*K;
M:=Cum(M*(J>0))-ValueWhen(D+1,J>0,Cum(M*(J>0)));
N:=Cum(J>0);
N:=Cum(N*(J>0))-ValueWhen(D+1,J>0,Cum(N*(J>0)));
X:=Cum(K*(J>0));
X:=X-ValueWhen(D+1,J>0,X);
Y:=Cum((J>0)*Pwr(Cum(J>0),2));
Y:=Y-ValueWhen(D+1,J>0,Y);
(D*M-N*X)/(D*Y-Pwr(N,2));
---8<---------------------------
========================
Weekly Linear Regression
========================
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly Linear Regression" plots a weekly Linear Regression
signal on any daily chart.
---8<---------------------------
{Weekly Linear Regression}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
N:=Input("Weekly Linear Regression Periods",1,99,14);
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,2);
{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:=LastValue(Cum(1))=Cum(1);
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)));
K:=ValueWhen(1,K>0,K);
A:=Cum(J>0);
B:=Cum(A*K*(J>0)); B:=B-ValueWhen(N+1,J,B);
D:=Cum(A*(J>0)); D:=D-ValueWhen(N+1,J,D);
F:=Cum(K*(J>0)); F:=F-ValueWhen(N+1,J,F);
G:=Cum(Pwr(A,2)*(J>0)); G:=G-ValueWhen(N+1,J,G);
I:=Pwr(D,2);
M:=Cum(K*(J>0)); M:=(M-ValueWhen(N+1,J,M))/N;
Q:=Cum(A*(J>0)); Q:=(Q-ValueWhen(N+1,J,Q))/N;
(N*B-D*F)/(N*G-I)*A+(M-Q*(N*B-D*F)/(N*G-I));
---8<---------------------------
===================
Weekly MACD - Close
===================
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly MACD - Close" plots weekly MACD and signal values
on any daily chart.
---8<---------------------------
{Weekly MACD - Close}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
N:=Input("Weekly MACD Signal Periods",1,19,9);
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,2);
{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:=LastValue(Cum(1))=Cum(1);
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)));
K:=ValueWhen(1,K>0,K);
X:=0.15; Y:=0.075; N:=2/(N+1);
X:=If(Cum(J>0)=1,K,ValueWhen(1,J,PREV)*(1-X)+K*X);
Y:=If(Cum(J>0)=1,K,ValueWhen(1,J,PREV)*(1-Y)+K*Y);
R:=X-Y;
Z:=If(Cum(J>0)=1,R,ValueWhen(1,J,PREV)*(1-N)+R*N);
R; {MACD}
Z; {Signal}
---8<---------------------------
===============
Weekly Momentum
===============
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly Momentum" plots a weekly momentum signal
on any daily chart.
---8<---------------------------
{Weekly Momentum}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
N:=Input("Weekly Momentum Periods",1,99,10);
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,2);
{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:=LastValue(Cum(1))=Cum(1);
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)));
K:=ValueWhen(1,K>0,K);
100*ValueWhen(1,J,K)/ValueWhen(N+1,J,K);
---8<---------------------------
===========
Weekly OHLC
===========
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly OHLC" plots weekly prices on any daily chart.
---8<---------------------------
{Weekly OHLC}
{© 2004 Roy Larsen, rlarsen@man.quik.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,2);
{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:=LastValue(Cum(1))=Cum(1);
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));
Hw:=HighestSince(1,M,H);
Hw:=ValueWhen(1,J,If(J=1,Hw,ValueWhen(2-G,1,Hw)));
Lw:=LowestSince(1,M,L);
Lw:=ValueWhen(1,J,If(J=1,Lw,ValueWhen(2-G,1,Lw)));
Cw:=ValueWhen(1,J,If(J=1,C,ValueWhen(2-G,1,C)));
Ow:=ValueWhen(1,J,If(J=1,ValueWhen(1,M,O),
ValueWhen(2-G,1,ValueWhen(1,M,O))));
Ow:=ValueWhen(1,Ow>0,Ow);
Hw:=ValueWhen(1,Hw>0,Hw);
Lw:=ValueWhen(1,Lw>0,Lw);
Cw:=ValueWhen(1,Cw>0,Cw);
Ow; Hw; Lw; Cw;
---8<---------------------------
==================
Weekly RSI - Close
==================
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly RSI - Close" plots a weekly RSI signal of the closing price
on any daily chart.
---8<---------------------------
{Weekly RSI - Close}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
N:=Input("Weekly RSI - Close Periods",1,99,10); Pc:=1/N;
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,2);
{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:=LastValue(Cum(1))=Cum(1);
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)));
K:=ValueWhen(1,K>0,K);
Ua:=ValueWhen(1,J>0,K); Da:=ValueWhen(2,J>0,K);
Ub:=If(Ua>Da,Ua-Da,0); Db:=If(Ua0)=N+1,Cum(If(J AND Cum(1)<>1,Ub,
0))/N,ValueWhen(1,J>0,PREV)*(1-Pc)+Ub*Pc);
D:=If(Cum(J>0)=N+1,Cum(If(J AND Cum(1)<>1,Db,
0))/N,ValueWhen(1,J>0,PREV)*(1-Pc)+Db*Pc);
D:=If(D=0,U,D);
D:=ValueWhen(1,D>0,D);
R:=100-(100/(1+(U/D)));
If(ValueWhen(N+1,J,R)>0,R,R);
---8<---------------------------
==================
Weekly SMA - Close
==================
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly SMA - Close" plots a simple moving average of the
weekly closing price on any daily chart.
---8<---------------------------
{Weekly SMA - Close}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
N:=Input("Weekly SMA - Close Periods",1,99,10);
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,2);
{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:=LastValue(Cum(1))=Cum(1);
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)));
X:=Cum((J>0)*K);
(X-ValueWhen(N+1,J,X))/N;
---8<---------------------------
==================
Weekly SMA - High
==================
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly SMA - High" plots a simple moving average of the weekly
high price on any daily chart.
---8<---------------------------
{Weekly SMA - High}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
N:=Input("Weekly SMA - High Periods",1,99,10);
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,2);
{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:=LastValue(Cum(1))=Cum(1);
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:=HighestSince(1,M,H);
K:=ValueWhen(1,J,If(J=1,K,ValueWhen(2-G,1,K)));
K:=ValueWhen(1,K>0,K);
X:=Cum((J>0)*K);
(X-ValueWhen(N+1,J,X))/N;
---8<---------------------------
================
Weekly SMA - Low
================
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly SMA - Low" plots a simple moving average of the weekly low
price on any daily chart.
---8<---------------------------
{Weekly SMA - Low}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
N:=Input("Weekly SMA - Low Periods",1,99,10);
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,2);
{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:=LastValue(Cum(1))=Cum(1);
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:=LowestSince(1,M,L);
K:=ValueWhen(1,J,If(J=1,K,ValueWhen(2-G,1,K)));
K:=ValueWhen(1,K>0,K);
X:=Cum((J>0)*K);
(X-ValueWhen(N+1,J,X))/N;
---8<---------------------------
=================
Weekly SMA - Open
=================
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly SMA - Open" plots a simple moving average of the weekly
open price on any daily chart.
---8<---------------------------
{Weekly SMA - Open}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
N:=Input("Weekly SMA - Open Periods",1,99,10);
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,2);
{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:=LastValue(Cum(1))=Cum(1);
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,ValueWhen(1,M,O),
ValueWhen(2-G,1,ValueWhen(1,M,O))));
K:=ValueWhen(1,K>0,K);
X:=Cum((J>0)*K);
(X-ValueWhen(N+1,J,X))/N;
---8<---------------------------
=========================
Weekly Standard Deviation
=========================
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly Standard Deviation" plots the weekly standard
deviation (or multiple) signal on any daily chart.
---8<---------------------------
{Weekly Standard Deviation}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
N:=Input("Weekly Standard Deviation Periods",2,26,10);
X:=Input("Deviations",0,9,2);
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,2);
{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:=LastValue(Cum(1))=Cum(1);
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)));
M:=(Cum(If(J,K,0))-ValueWhen(N+1,J,Cum(If(J,K,0))))/N;
N1:=LastValue((N>5)*5); N2:=LastValue((N>10)*10);
N3:=LastValue((N>15)*15); N4:=LastValue((N>20)*20);
Y:=Power(M-ValueWhen(1,J,K),2)+
Power(M-ValueWhen(2,J,K),2)+
(N>2)*Power(M-ValueWhen(3,J,K),2)+
(N>3)*Power(M-ValueWhen(4,J,K),2)+
(N>4)*Power(M-ValueWhen(5,J,K),2)+
(N>5)*Power(M-ValueWhen(N1+1,J,K),2)+
(N>6)*Power(M-ValueWhen(N1+2,J,K),2)+
(N>7)*Power(M-ValueWhen(N1+3,J,K),2)+
(N>8)*Power(M-ValueWhen(N1+4,J,K),2)+
(N>9)*Power(M-ValueWhen(N1+5,J,K),2)+
(N>10)*Power(M-ValueWhen(N2+1,J,K),2)+
(N>11)*Power(M-ValueWhen(N2+2,J,K),2)+
(N>12)*Power(M-ValueWhen(N2+3,J,K),2)+
(N>13)*Power(M-ValueWhen(N2+4,J,K),2)+
(N>14)*Power(M-ValueWhen(N2+5,J,K),2)+
(N>15)*Power(M-ValueWhen(N3+1,J,K),2)+
(N>16)*Power(M-ValueWhen(N3+2,J,K),2)+
(N>17)*Power(M-ValueWhen(N3+3,J,K),2)+
(N>18)*Power(M-ValueWhen(N3+4,J,K),2)+
(N>19)*Power(M-ValueWhen(N3+5,J,K),2)+
(N>20)*Power(M-ValueWhen(N4+1,J,K),2)+
(N>21)*Power(M-ValueWhen(N4+2,J,K),2)+
(N>22)*Power(M-ValueWhen(N4+3,J,K),2)+
(N>23)*Power(M-ValueWhen(N4+4,J,K),2)+
(N>24)*Power(M-ValueWhen(N4+5,J,K),2)+
(N>25)*Power(M-ValueWhen(N4+6,J,K),2);
X*Sqrt(Y/N);
---8<---------------------------
================================
Weekly Stochastic Oscillator EMA
================================
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly Stochastic Oscillator EMA" plots a weekly stochastic
oscillator and signal with EMA smoothing on any daily chart.
---8<---------------------------
{Weekly Stochastic Osc EMA}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
K:=Input("Weekly Stochastic Oscillator %K Periods",1,99,5);
N:=Input("%K Slowing Periods" ,1,99,3);
R:=Input("%D EMA Periods",1,99,3);
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,2);
{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:=LastValue(Cum(1))=Cum(1);
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));
Hw:=HighestSince(1,M,H);
Hw:=ValueWhen(1,J,If(J=1,Hw,ValueWhen(2,1,Hw)));
Lw:=LowestSince(1,M,L);
Lw:=ValueWhen(1,J,If(J=1,Lw,ValueWhen(2,1,Lw)));
Cw:=ValueWhen(1,J,If(J=1,C,ValueWhen(2,1,C)));
Hw:=ValueWhen(1,Hw>0,Hw);
Lw:=ValueWhen(1,Lw>0,Lw);
Cw:=ValueWhen(1,Cw>0,Cw);
Z:=Cum((Cw-LowestSince(K,J,Lw))*(J>0));
Z:=Z-ValueWhen(N+1,J,Z);
I:=Cum((HighestSince(K,J,Hw)- LowestSince(K,J,Lw))*(J>0));
I:=I-ValueWhen(N+1,J,I);
I:=ValueWhen(1,Cum(I>0)>0,I);
X:=100*Z/I; A:=2/(1+R);
X:=ValueWhen(1,Cum(J>0)>=K+N,X);
Y:=ValueWhen(1,J,PREV)*(1-A)+X*A;
Y:=ValueWhen(1,Cum(J>0)>=K+N+R,Y);
X; {%K}
Y; {%D}
---8<---------------------------
================================
Weekly Stochastic Oscillator SMA
================================
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly Stochastic Oscillator SMA" plots a weekly stochastic
oscillator and signal with SMA smoothing on any daily chart.
---8<---------------------------
{Weekly Stochastic Osc SMA}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
K:=Input("Weekly Stochastic Oscillator %K Periods",1,99,5);
N:=Input("%K Slowing Periods" ,1,99,3);
R:=Input("%D SMA Periods",1,99,3);
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,2);
{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:=LastValue(Cum(1))=Cum(1);
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));
Hw:=HighestSince(1,M,H);
Hw:=ValueWhen(1,J,If(J=1,Hw,ValueWhen(2,1,Hw)));
Lw:=LowestSince(1,M,L);
Lw:=ValueWhen(1,J,If(J=1,Lw,ValueWhen(2,1,Lw)));
Cw:=ValueWhen(1,J,If(J=1,C,ValueWhen(2,1,C)));
Hw:=ValueWhen(1,Hw>0,Hw);
Lw:=ValueWhen(1,Lw>0,Lw);
Cw:=ValueWhen(1,Cw>0,Cw);
Z:=Cum((Cw-LowestSince(K,J,Lw))*(J>0));
Z:=Z-ValueWhen(N+1,J,Z);
I:=Cum((HighestSince(K,J,Hw)- LowestSince(K,J,Lw))*(J>0));
I:=I-ValueWhen(N+1,J,I);
I:=ValueWhen(1,Cum(I>0)>0,I);
X:=100*Z/I; X:=ValueWhen(1,Cum(J>0)>=K+N,X);
Y:=Cum((J>0)*X); Y:=(Y-ValueWhen(R+1,J,Y))/R;
Y:=ValueWhen(1,Cum(J>0)>=K+N+R,Y);
X; {%K}
Y; {%D}
---8<---------------------------
=====================
Weekly Timing Signals
=====================
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly Timing Signals" plots the 'J' timing signal that is used in
every weekly indicator in this series. This signal has a value of "1"
for a known Friday (day-of-week = 5 following at least one other trading
day in the week), and a value of "2" for a nominal Monday (the first bar
of a new week).
---8<---------------------------
{Weekly Timing Signals}
{© 2004 Roy Larsen, rlarsen@man.quik.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,2);
{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:=LastValue(Cum(1))=Cum(1);
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));
J;
---8<---------------------------
=============
Weekly Volume
=============
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly Volume" plots the weekly volume on any daily chart.
---8<---------------------------
{Weekly Volume}
{© 2004 Roy Larsen, rlarsen@man.quik.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,2);
{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:=LastValue(Cum(1))=Cum(1);
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:=If(M,V,PREV+V);
ValueWhen(1,J,If(J=1,K,ValueWhen(2-G,1,K)));
---8<---------------------------
======================
Weekly Wilders - Close
======================
A prerequisite for this indicator is Jose Silva's "Calendar Week
counter".
"Weekly Wilders - Close" plots the Wilders Smoothing weekly
average of the close on any daily chart.
---8<---------------------------
{Weekly Wilders - Close}
{© 2004 Roy Larsen, rlarsen@man.quik.co.nz}
{for use on daily charts with
Jose Silva's "Calendar Week counter"}
N:=Input("Weekly Wilders Smoothing Periods",1,99,10);
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,2);
{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:=LastValue(Cum(1))=Cum(1);
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)));
N:=1/N;
If(Cum(G+J>0)<=2-G,K, ValueWhen(1,J,PREV)*(1-N)+K*N);
---8<---------------------------
http://www.metastocktips.co.nz/