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

RE: [EquisMetaStock Group] a smoother RSI



PureBytes Links

Trading Reference Links

Hi Jose,

I see that you are very good at writing weighted oscillators. Can you give 
me some guidance of how to write a fibonacci timeline weighted stochastic 
oscillator? I got the idea from a book that I am reading at the moment.


Many thanks.


Regards

PJ
----Original Message Follows----
From: "Jose" <josesilva22@xxxxxxxxx>
Reply-To: equismetastock@xxxxxxxxxxxxxxx
To: equismetastock@xxxxxxxxxxxxxxx
Subject: [EquisMetaStock Group] a smoother RSI
Date: Thu, 26 Feb 2004 12:00:49 -0000


===========================
RSI, sine-weighted smoothed
===========================

---8<--------------------------------

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

{ user input }
pds:=1/Input("RSI periods",2,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 }
sd:=30 {180/6};
s1:=Sin(1*sd)*up;
s2:=Sin(2*sd)*Ref(up,-1);
s3:=Sin(3*sd)*Ref(up,-2);
s4:=Sin(4*sd)*Ref(up,-3);
s5:=Sin(5*sd)*Ref(up,-4);
up:=(s1+s2+s3+s4+s5)/(Sin(sd)+Sin(2*sd)
  +Sin(3*sd)+Sin(4*sd)+Sin(5*sd));
S1:=Sin(1*sd)*dw;
S2:=Sin(2*sd)*Ref(dw,-1);
S3:=Sin(3*sd)*Ref(dw,-2);
S4:=Sin(4*sd)*Ref(dw,-3);
S5:=Sin(5*sd)*Ref(dw,-4);
dw:=(s1+s2+s3+s4+s5)/(Sin(sd)+Sin(2*sd)
  +Sin(3*sd)+Sin(4*sd)+Sin(5*sd));

{ 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)

---8<--------------------------------

_________________________________________________________________
Surf the net and talk on the phone with Xtra JetStream @  
http://xtra.co.nz/jetstream



------------------------ 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/BefplB/TM
---------------------------------------------------------------------~->

 
Yahoo! Groups Links

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

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

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