[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Metastockusers] Dual RSI Sine Weighted



PureBytes Links

Trading Reference Links

The RSI Sine Weighted indicator was developed by Jose Silva,
I modified it to allow 2 different RSI's to be Plotted in the same 
window

{Dual RSI Sine Weighted }

pds:= Input("RSI periods",2,2520,5);
{ 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-(1/pds))+x*(1/pds);
dw:=PREV*(1-(1/pds))+y*(1/pds);
{ sine-weighted internal smoothing }
s1:=Sin(30)*up;
s2:=Sin(60)*Ref(up,-1);
s3:=Sin(90)*Ref(up,-2);
s4:=Sin(120)*Ref(up,-3);
s5:=Sin(150)*Ref(up,-4);
up:=(s1+s2+s3+s4+s5)/(Sin(30)+Sin(60)
+Sin(90)+Sin(120)+Sin(150));
S1:=Sin(30)*dw;
S2:=Sin(60)*Ref(dw,-1);
S3:=Sin(90)*Ref(dw,-2);
S4:=Sin(120)*Ref(dw,-3);
S5:=Sin(150)*Ref(dw,-4);
dw:=If(0,.000001,(s1+s2+s3+s4+s5)/(Sin(30)+Sin(60)
+Sin(90)+Sin(120)+Sin(150)));
RS1:=100-100/(1+up/dw);
up:=PREV*(1-(1/(5*pds)))+x*(1/(5*pds));
dw:=PREV*(1-(1/(5*pds)))+y*(1/(5*pds));
s1:=Sin(30)*up;
s2:=Sin(60)*Ref(up,-1);
s3:=Sin(90)*Ref(up,-2);
s4:=Sin(120)*Ref(up,-3);
s5:=Sin(150)*Ref(up,-4);
up:=(s1+s2+s3+s4+s5)/(Sin(30)+Sin(60)
+Sin(90)+Sin(120)+Sin(150));
S1:=Sin(30)*dw;
S2:=Sin(60)*Ref(dw,-1);
S3:=Sin(90)*Ref(dw,-2);
S4:=Sin(120)*Ref(dw,-3);
S5:=Sin(150)*Ref(dw,-4);
dw:=If(0,.000001,(s1+s2+s3+s4+s5)/(Sin(30)+Sin(60)
+Sin(90)+Sin(120)+Sin(150)));
RS2:=100-100/(1+up/dw);
RS1;Ref(RS1,-1);RS2;


now for the Expert

Highlight tab

Long

pds:= 5;
up:=PREV*(1-(1/pds))+ If(C>Ref(C,-1),C-Ref(C,-1),0)*(1/pds);
dw:=PREV*(1-(1/pds))+ If(C<Ref(C,-1),Ref(C,-1)-C,0)*(1/pds);
s1:=Sin(30)*up;
s2:=Sin(60)*Ref(up,-1);
s3:=Sin(90)*Ref(up,-2);
s4:=Sin(120)*Ref(up,-3);
s5:=Sin(150)*Ref(up,-4);
up:=(s1+s2+s3+s4+s5)/(Sin(30)+Sin(60)
+Sin(90)+Sin(120)+Sin(150));
S1:=Sin(30)*dw;
S2:=Sin(60)*Ref(dw,-1);
S3:=Sin(90)*Ref(dw,-2);
S4:=Sin(120)*Ref(dw,-3);
S5:=Sin(150)*Ref(dw,-4);
dw:=If(0,.000001,(s1+s2+s3+s4+s5)/(Sin(30)+Sin(60)
+Sin(90)+Sin(120)+Sin(150)));
RS1:=100-100/(1+up/dw);
up:=PREV*(1-(1/(5*pds)))+ If(C>Ref(C,-1),C-Ref(C,-1),0)*(1/(5*pds));
dw:=PREV*(1-(1/(5*pds)))+ If(C<Ref(C,-1),Ref(C,-1)-C,0)*(1/(5*pds));
s1:=Sin(30)*up;
s2:=Sin(60)*Ref(up,-1);
s3:=Sin(90)*Ref(up,-2);
s4:=Sin(120)*Ref(up,-3);
s5:=Sin(150)*Ref(up,-4);
up:=(s1+s2+s3+s4+s5)/(Sin(30)+Sin(60)
+Sin(90)+Sin(120)+Sin(150));
S1:=Sin(30)*dw;
S2:=Sin(60)*Ref(dw,-1);
S3:=Sin(90)*Ref(dw,-2);
S4:=Sin(120)*Ref(dw,-3);
S5:=Sin(150)*Ref(dw,-4);
dw:=If(0,.000001,(s1+s2+s3+s4+s5)/(Sin(30)+Sin(60)
+Sin(90)+Sin(120)+Sin(150)));
RS2:=100-100/(1+up/dw);
B:=If(BarsSince(RS1>RS2)<BarsSince(RS1<RS2),1,0);
B=1

Short

pds:= 5;
up:=PREV*(1-(1/pds))+ If(C>Ref(C,-1),C-Ref(C,-1),0)*(1/pds);
dw:=PREV*(1-(1/pds))+ If(C<Ref(C,-1),Ref(C,-1)-C,0)*(1/pds);
s1:=Sin(30)*up;
s2:=Sin(60)*Ref(up,-1);
s3:=Sin(90)*Ref(up,-2);
s4:=Sin(120)*Ref(up,-3);
s5:=Sin(150)*Ref(up,-4);
up:=(s1+s2+s3+s4+s5)/(Sin(30)+Sin(60)
+Sin(90)+Sin(120)+Sin(150));
S1:=Sin(30)*dw;
S2:=Sin(60)*Ref(dw,-1);
S3:=Sin(90)*Ref(dw,-2);
S4:=Sin(120)*Ref(dw,-3);
S5:=Sin(150)*Ref(dw,-4);
dw:=If(0,.000001,(s1+s2+s3+s4+s5)/(Sin(30)+Sin(60)
+Sin(90)+Sin(120)+Sin(150)));
RS1:=100-100/(1+up/dw);
up:=PREV*(1-(1/(5*pds)))+ If(C>Ref(C,-1),C-Ref(C,-1),0)*(1/(5*pds));
dw:=PREV*(1-(1/(5*pds)))+ If(C<Ref(C,-1),Ref(C,-1)-C,0)*(1/(5*pds));
s1:=Sin(30)*up;
s2:=Sin(60)*Ref(up,-1);
s3:=Sin(90)*Ref(up,-2);
s4:=Sin(120)*Ref(up,-3);
s5:=Sin(150)*Ref(up,-4);
up:=(s1+s2+s3+s4+s5)/(Sin(30)+Sin(60)
+Sin(90)+Sin(120)+Sin(150));
S1:=Sin(30)*dw;
S2:=Sin(60)*Ref(dw,-1);
S3:=Sin(90)*Ref(dw,-2);
S4:=Sin(120)*Ref(dw,-3);
S5:=Sin(150)*Ref(dw,-4);
dw:=If(0,.000001,(s1+s2+s3+s4+s5)/(Sin(30)+Sin(60)
+Sin(90)+Sin(120)+Sin(150)));
RS2:=100-100/(1+up/dw);
B:=If(BarsSince(RS1>RS2)<BarsSince(RS1<RS2),1,0);
B=0

Under the Symbol Tab

Long entry

pds:= 5;
up:=PREV*(1-(1/pds))+ If(C>Ref(C,-1),C-Ref(C,-1),0)*(1/pds);
dw:=PREV*(1-(1/pds))+ If(C<Ref(C,-1),Ref(C,-1)-C,0)*(1/pds);
s1:=Sin(30)*up;
s2:=Sin(60)*Ref(up,-1);
s3:=Sin(90)*Ref(up,-2);
s4:=Sin(120)*Ref(up,-3);
s5:=Sin(150)*Ref(up,-4);
up:=(s1+s2+s3+s4+s5)/(Sin(30)+Sin(60)
+Sin(90)+Sin(120)+Sin(150));
S1:=Sin(30)*dw;
S2:=Sin(60)*Ref(dw,-1);
S3:=Sin(90)*Ref(dw,-2);
S4:=Sin(120)*Ref(dw,-3);
S5:=Sin(150)*Ref(dw,-4);
dw:=If(0,.000001,(s1+s2+s3+s4+s5)/(Sin(30)+Sin(60)
+Sin(90)+Sin(120)+Sin(150)));
RS1:=100-100/(1+up/dw);
up:=PREV*(1-(1/(5*pds)))+ If(C>Ref(C,-1),C-Ref(C,-1),0)*(1/(5*pds));
dw:=PREV*(1-(1/(5*pds)))+ If(C<Ref(C,-1),Ref(C,-1)-C,0)*(1/(5*pds));
s1:=Sin(30)*up;
s2:=Sin(60)*Ref(up,-1);
s3:=Sin(90)*Ref(up,-2);
s4:=Sin(120)*Ref(up,-3);
s5:=Sin(150)*Ref(up,-4);
up:=(s1+s2+s3+s4+s5)/(Sin(30)+Sin(60)
+Sin(90)+Sin(120)+Sin(150));
S1:=Sin(30)*dw;
S2:=Sin(60)*Ref(dw,-1);
S3:=Sin(90)*Ref(dw,-2);
S4:=Sin(120)*Ref(dw,-3);
S5:=Sin(150)*Ref(dw,-4);
dw:=If(0,.000001,(s1+s2+s3+s4+s5)/(Sin(30)+Sin(60)
+Sin(90)+Sin(120)+Sin(150)));
RS2:=100-100/(1+up/dw);
B:=If(BarsSince(RS1>RS2)<BarsSince(RS1<RS2),1,0);
B=1 and Ref(B,-1)=0

Short Entry

pds:= 5;
up:=PREV*(1-(1/pds))+ If(C>Ref(C,-1),C-Ref(C,-1),0)*(1/pds);
dw:=PREV*(1-(1/pds))+ If(C<Ref(C,-1),Ref(C,-1)-C,0)*(1/pds);
s1:=Sin(30)*up;
s2:=Sin(60)*Ref(up,-1);
s3:=Sin(90)*Ref(up,-2);
s4:=Sin(120)*Ref(up,-3);
s5:=Sin(150)*Ref(up,-4);
up:=(s1+s2+s3+s4+s5)/(Sin(30)+Sin(60)
+Sin(90)+Sin(120)+Sin(150));
S1:=Sin(30)*dw;
S2:=Sin(60)*Ref(dw,-1);
S3:=Sin(90)*Ref(dw,-2);
S4:=Sin(120)*Ref(dw,-3);
S5:=Sin(150)*Ref(dw,-4);
dw:=If(0,.000001,(s1+s2+s3+s4+s5)/(Sin(30)+Sin(60)
+Sin(90)+Sin(120)+Sin(150)));
RS1:=100-100/(1+up/dw);
up:=PREV*(1-(1/(5*pds)))+ If(C>Ref(C,-1),C-Ref(C,-1),0)*(1/(5*pds));
dw:=PREV*(1-(1/(5*pds)))+ If(C<Ref(C,-1),Ref(C,-1)-C,0)*(1/(5*pds));
s1:=Sin(30)*up;
s2:=Sin(60)*Ref(up,-1);
s3:=Sin(90)*Ref(up,-2);
s4:=Sin(120)*Ref(up,-3);
s5:=Sin(150)*Ref(up,-4);
up:=(s1+s2+s3+s4+s5)/(Sin(30)+Sin(60)
+Sin(90)+Sin(120)+Sin(150));
S1:=Sin(30)*dw;
S2:=Sin(60)*Ref(dw,-1);
S3:=Sin(90)*Ref(dw,-2);
S4:=Sin(120)*Ref(dw,-3);
S5:=Sin(150)*Ref(dw,-4);
dw:=If(0,.000001,(s1+s2+s3+s4+s5)/(Sin(30)+Sin(60)
+Sin(90)+Sin(120)+Sin(150)));
RS2:=100-100/(1+up/dw);
B:=If(BarsSince(RS1>RS2)<BarsSince(RS1<RS2),1,0);
B=0 and Ref(B,-1)=1


Now for the System Tester

Buy Order & Buy to Cover Order

A1:= FmlVar("Dual RSI sine weighted","RS1");
A2:= FmlVar("Dual RSI sine weighted","RS2");
B:=If(BarsSince(A1>A2)<BarsSince(A1<A2),1,0);
B=1 and Ref(B,-1)=0 

Sell Order & Sell Short Order

A1:= FmlVar("Dual RSI sine weighted","RS1");
A2:= FmlVar("Dual RSI sine weighted","RS2");
B:=If(BarsSince(A1>A2)<BarsSince(A1<A2),1,0);
B=0 and Ref(B,-1)=1 

In the Enhanced System Tester, you should notice that using a points 
only test, 1 bar delay, prices set at open the test results only 
show trades for a long position and close long. It doesn't truly 
reflect this system as a stop and reverse system, thus giving flawed 
results

Henry 



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/zMEolB/TM
---------------------------------------------------------------------~->

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/Metastockusers/

<*> To unsubscribe from this group, send an email to:
     Metastockusers-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/