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 #

RSI - Sine-weighted Smoothed by Jose Silva
Sine-weighted smoothed RSI, automatic historically-valid RSI peak/trough boundaries & signals.

RSI - Sine-weighted Smoothed

{ Smoothed RSI indicator v1.1 }
{ Internal sine-weighted smoothing }
{ Automatic historically-valid RSI peak/trough
boundaries}
{ Boundary crossover signals: +1=Long, -1=Short}
{ ©Copyright 2004 Jose Silva }
{ http://www.metastocktools.com }

{ user input }
pds:=1/Input("RSI periods",1,2520,10);
plot:=Input("plot: [1]-RSI, [2]-Long/Short signals",1,2,1);

{ RSI up/down average components }
x:=If(C>Ref(C,-1),C-Ref(C,-1),0);
y:=If(C<Ref(C,-1),Ref(C,-1)-C,0);
up:=PREV*(1-pds)+x*pds;
dw:=PREV*(1-pds)+y*pds;

{ sine-weighted internal smoothing }
s1:=Sin(30)*up;
s2:=Sin(60)*Ref(up,-1);
s3:=Sin(90)*Ref(up,-2);
s4:=Sin(60)*Ref(up,-3);
s5:=Sin(30)*Ref(up,-4);
up:=(s1+s2+s3+s4+s5)/(Sin(30)*2+Sin(60)*2
+Sin(90));
S1:=Sin(30)*dw;
S2:=Sin(60)*Ref(dw,-1);
S3:=Sin(90)*Ref(dw,-2);
S4:=Sin(60)*Ref(dw,-3);
S5:=Sin(30)*Ref(dw,-4);
dw:=(s1+s2+s3+s4+s5)/(Sin(30)*2+Sin(60)*2
+Sin(90));

{ RSI indicator }
dw:=If(dw=0,.000001,dw);
RS:=100-100/(1+up/dw);

{ automatic RSI peak/trough boundaries }
pk:=Ref(RS,-1)>Ref(RS,-2) AND Ref(RS,-1)>RS
AND Alert(Ref(C,-1)>Ref(C,-2)
AND Ref(C,-1)>C,2) {AND Ref(RS,-1)>50};
pkVal:=ValueWhen(1,pk,Ref(RS,-1));
pkAvg:=Cum(pkVal)/Cum(pkVal>-1);
tr:=Ref(RS,-1)<Ref(RS,-2) AND Ref(RS,-1)<RS
AND Alert(Ref(C,-1)<Ref(C,-2)
AND Ref(C,-1)<C,2) {AND Ref(RS,-1)<50};
trVal:=ValueWhen(1,tr,Ref(RS,-1));
trAvg:=Cum(trVal)/Cum(trVal>-1);

{ RSI peak/trough boundary cross signals }
up:=Cross(trAvg,RS);
dw:=Cross(RS,pkAvg);
signals:=up-dw;

{ alternative RSI peak/trough signals }
{up:=Ref(RS,-1)<Ref(RS,-2) AND Ref(RS,-1)<RS
AND Ref(RS,-1)<trAvg;
dw:=Ref(RS,-1)>Ref(RS,-2) AND Ref(RS,-1)>RS
AND Ref(RS,-1)>pkAvg;
signals:=up-dw;}

{ plot }
If(plot=1,pkAvg,0);
If(plot=1,trAvg,0);
If(plot=1,RS,signals)

 

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.

TradeStation® Pro, TradeStation® 2000i, OptionStation®, SuperCharts®, PowerEditor® and EasyLanguage®
are registered trademarks of TradeStation Technologies, Inc. Other names and marks referred to are the property of their respective owners.

All information provided on this website is for educational purposes only. Trading involves risk, including possible loss of principal and other losses.

Ten i inne materiały na tej stronie zostały zamieszczone zostały jedynie w celach edukacyjnych, nie ponoszę żadnej odpowiedzialno¶ci za ich stosowanie.

Gra na giełdzie i rynkach walutowych (FOREX) niesie ze sob± ryzyko poważnych strat finansowych!