================================ Daily Stochastic Oscillator EMA ================================ A prerequisite for this indicator is Jose Silva's "Calendar Day counter". "Daily Stochastic Oscillator EMA" plots a daily stochastic oscillator and signal with EMA smoothing on any intraday chart with sufficient historical data. ---8<--------------------------- {Daily Stochastic Osc EMA} {© 2004 Roy Larsen, rlarsen@man.quik.co.nz} {for use on intraday charts with Jose Silva's "Calendar Day counter"} K:=Input("Daily Stochastic Oscillator %K Periods",1,99,5); N:=Input("%K Slowing Periods" ,1,99,3); R:=Input("%D EMA Periods",1,99,3); A:=Input("Hour of Last Daily Bar" ,0,23,16); B:=Input("Minute of Last Daily Bar",0,59,00); Q:=Input("Display Mode, 0=Static 1=Dynamic 2=Test",0,2,2); {0=Display, update at last bar of day} {1=Display, update on each new bar} {2=Backtest, update on first bar of new day} G:=LastValue(Highest(Sum(DayOfWeek()<> ValueWhen(2,1,DayOfWeek()),5))=5); I:=Fml("Calendar Day counter"); I:=Abs(I-ValueWhen(2-G,1,I)); M:=G OR I>0; F:=G OR (Hour()=A AND Minute()=B); 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<--------------------------- http://www.metastocktips.co.nz/