MetaStock™ Zone Forum & FAQ Artykuły Linki Elliott Waves EasyLanguage™ Zone

 A B C D E F G H I J K L M N O P R S T U V W Y Z #

Exponential Moving Average - Oscillator, Sine-weighted by Jose Silva
Normalized, lag-less, sine-weighted Moving Average, MA oscillator, and divergence signals.

Exponential Moving Average - Oscillator, Sine-weighted

{ Lag-less, sine-weighted Mov Avg (SWMA)& normalized MA oscillator v2.0 }
{ Divergence signals between SWMA & oscillator: +1=Long, -1=Short }
{ (c) Copyright 2004 Jose Silva }
{ http://www.metastocktools.com }

plot:=Input("[1]-SWMA Osc, [2]-SW Mov Avg, [3]-Divergences",1,3,1);
pds:=Input("normalizing periods (1=none)",
1,2520,252);

s1:=Sin(30)*C;
s2:=Sin(60)*Ref(C,-1);
s3:=Sin(90)*Ref(C,-2);
s4:=Sin(60)*Ref(C,-3);
s5:=Sin(30)*Ref(C,-4);
s7:=-Sin(30)*Ref(C,-5);
s8:=-Sin(60)*Ref(C,-6);
s9:=-Sin(90)*Ref(C,-7);
s10:=-Sin(60)*Ref(C,-8);
s11:=-Sin(30)*Ref(C,-9);
SWMA:=
(s1+s2+s3+s4+s5)/(Sin(30)*2+Sin(60)*2+Sin(90));
SWosc:=s1+s2+s3+s4+s5+s7+s8+s9+s10+s11;

SWoscNorm:=(SWosc-LLV(SWosc,pds))
/(HHV(SWosc,pds)-LLV(SWosc,pds)+.000001)*100;
SWoscNorm:=If(pds<2,SWosc,SWoscNorm);
up:=SWoscNorm>Ref(SWoscNorm,-1)
AND SWMA<Ref(SWMA,-1);
dw:=SWoscNorm<Ref(SWoscNorm,-1)
AND SWMA>Ref(SWMA,-1);

If(plot=1,SWoscNorm,If(plot=2,SWMA,up-dw))

Source / From: TOP
http://www.metastocktools.com

Equis and MetaStock® and MetaStock Professional® are registered trademarks of Equis International. Achelis Binary Wave®, The DownLoader®,
Expert Advisor®, OptionScope®, Quotecenter® and Smart Charts® are trademarks of Equis International, a Thomson Reuters company.