================================= 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<--------------------------- http://www.metastocktips.co.nz/