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

Re: [EquisMetaStock Group] Re: RSI Calculation



PureBytes Links

Trading Reference Links

Preston,

This is my ver of the RMO Osc:

m1:=mov(c,2,s);
m2:=mov(m1,2,s);
m3:=mov(m2,2,s);
m4:=mov(m3,2,s);
m5:=mov(m4,2,s);
m6:=mov(m5,2,s);
m7:=mov(m6,2,s);
m8:=mov(m7,2,s);
m9:=mov(m8,2,s);
m10:=mov(m9,2,s);

mm:=(m1+m2+m3+m4+m5+m6+m7+m8+m9+m10)/10;

ST1:=100 *(c-mm)/max(hhv(c,10)-llv(c,10),0.000001);

RMO:=Mov(ST1,81,E);
RMO;

--- On Sat, 28/2/09, pumrysh <no_reply@xxxxxxxxxxxxxxx> wrote:
From: pumrysh <no_reply@xxxxxxxxxxxxxxx>
Subject: [EquisMetaStock Group] Re: RSI Calculation
To: equismetastock@xxxxxxxxxxxxxxx
Date: Saturday, 28 February, 2009, 4:56 AM

Joo,

Just noticed that I had written recussion... .that should have been
recursion.

Thus far we have:

(Mov(C,2,S)+
Mov(Mov(C,2, S),2,S)+
Mov(Mov(Mov( C,2,S),2, S),2,S)+
Mov(Mov(Mov( Mov(C,2,S) ,2,S),2,S) ,2,S)+
Mov(Mov(Mov( Mov(Mov(C, 2,S),2,S) ,2,S),2,S) ,2,S)+
Mov(Mov(Mov( Mov(Mov(Mov( C,2,S),2, S),2,S),2, S),2,S),2, S)+
Mov(Mov(Mov( Mov(Mov(Mov( Mov(C,2,S) ,2,S),2,S) ,2,S),2,S) ,2,S),2,S) +
Mov(Mov(Mov( Mov(Mov(Mov( Mov(Mov
(C,2,S),2,S) ,2,S),2,S) ,2,S),2,S) ,2,S),2,S) +
Mov(Mov(Mov( Mov(Mov(Mov( Mov(Mov(Mov
(C,2,S),2,S) ,2,S),2,S) ,2,S),2,S) ,2,S),2,S) ,2,\
S)+
Mov(Mov(Mov( Mov(Mov(Mov( Mov(Mov(Mov( Mov
(C,2,S),2,S) ,2,S),2,S) ,2,S),2,S) ,2,S),2,S\
),2,S),2,S)) /10;

can be written down in the following analytical form:

(C*1023+Ref( C,-1)*2036+ Ref(C,-2) *1981+
Ref(C,-3)*1816+ Ref(C,-4) *1486+Ref( C,-5)*1024+
Ref(C,-6)*562+ Ref(C,-7) *232+Ref( C,-8)*67+
Ref(C,-9)*12+ Ref(C,-10) )/10240

What I would like to be able to do is simplify these formulas. Both
are hardwired and in order to change them it requires that the code
be rewritten. I also want to input the variables for the simple
moving average and the recursive moving average.

Preston

--- In equismetastock@ yahoogroups. com, joo seng <jooseng6@xx .> wrote:
>
> Hi Preston,
> Do you means you want to vary the no. of times of the mov of mov?
>
> --- On Sat, 28/2/09, pumrysh <no_reply@xxxxxxxxxx s.com> wrote:
> From: pumrysh <no_reply@xxxxxxxxxx s.com>
> Subject: [EquisMetaStock Group] Re: RSI Calculation
> To: equismetastock@ yahoogroups. com
> Date: Saturday, 28 February, 2009, 1:14 AM
>
>
>
>
>
>
>
>
>
>
>
>
> Ken,
>
>
>
> You are more than welcome! The RSI is one of my favorite
indicators.
>
> It took us a bit to realize the differences between the two
smoothing
>
> methods. I have to laugh everytime I read that someone is using
>
> shorter lookback periods with success. Seems Wilder knew that
already.
>
>
>
> While I have your attention and since you mentioned recussion, let
me
>
> ask for your help. A few days ago we were discussing the
Rainbow/RMO
>
> indicator. The method used to smooth the indicator was a recursive
>
> smoothing. Normally this wouldn't be so tedious but in the case of
>
> the Rainbow/RMO it is a moving average of a moving
average..... ..and
>
> on. We can code the indicator but not in a way that allows for any
>
> lookback changes without reproducing the complete indicator,
>
> basically its hardwired. Just wondering if you might have some
>
> thoughts on ways to simplify the indicator.
>
>
>
> Preston
>
>
>
> --- In equismetastock@ yahoogroups. com, "antoinesax"
<kennethmetz@ ...>
>
> wrote:
>
> >
>
> > Thanks, Preston.
>
> >
>
> > I had just come to a similar conclusion.
>
> >
>
> > After reviewing Wilder's original publication, I recognized that
he
>
> > used a form of exponential smoothing with factors 1/N and 1 -
>
> (1/N),
>
> > where N is the RSI period. In contrast, the usual EMA uses
factors
>
> 2/
>
> > (M + 1) and 1 - 2/(M+1), where M is the EMA period. Equating the
>
> > corresponding factors produces the results that M = 2*N -1 and N
=
>
> (M
>
> > + 1)/2.
>
> >
>
> > Using Mov(C, M, E) instead of Mov(C, N, E) in my original code
>
> > renders identical results to MS's RSI.
>
> >
>
> > Ken
>
> >
>
> >
>
> > --- In equismetastock@ yahoogroups. com, pumrysh <no_reply@>
wrote:
>
> > >
>
> > > Kenneth,
>
> > >
>
> > > I can verify that Wilders used Wilders smoothing when he wrote
>
> the
>
> > > RSI. Wilders is a variant form of exponential smoothing.
>
> > >
>
> > > The difference is in the lookback periods.
>
> > >
>
> > > Here's a quicky formula to confirm this. Not precise but very
>
> close:
>
> > >
>
> > > N:=Input("Periods" ,1,250,25) ;
>
> > > R:=(N/2)+1;
>
> > > Mov(CLOSE,N, E);
>
> > > Wilders(CLOSE, R);
>
> > >
>
> > > Notice that the Wilders formula uses a different lookback
period
>
> > that
>
> > > is calculated in the "R" array…basically half plus one. If
you
>
> > change
>
> > > the lookback period you will notice a larger variance at
shorter
>
> > > periods. It is due to the initial seeding at the beginning of
the
>
> > > data.
>
> > >
>
> > >
>
> > > Roy Larsen has discussed this many times before and again a
>
> simple
>
> > > search of our archived messages will yield a number of emails
to
>
> > this
>
> > > very point. His website is :
>
> > >
>
> > > www.metastocktips. co.nz
>
> > >
>
> > > There you will find a number of indicators that he has written.
>
> His
>
> > > link along with others that will help you can be found in our
>
> links
>
> > > section. A RSI written by Roy is listed below.
>
> > >
>
> > >
>
> > > {RSI Indicator}
>
> > > N:=Input("Periods" ,2,99,10) ;
>
> > > A:=Close;
>
> > > B:=Ref(A,-1) ;
>
> > > U:=Wilders(If( A>B,A-B,0) ,N);
>
> > > D:=Wilders(If( A<B,B-A,0) ,N);
>
> > > 100-(100/(1+ (U/D)));
>
> > >
>
> > >
>
> > > Hope this helps,
>
> > >
>
> > >
>
> > > Preston
>
> > >
>
> > >
>
> > >
>
> > >
>
> > > --- In equismetastock@ yahoogroups. com, "antoinesax"
>
> <kennethmetz@ >
>
> > > wrote:
>
> > > >
>
> > > > Preston, Thanks for your reply.
>
> > > >
>
> > > > I'm not sure which method Wilder used. But it seems that MS
>
> > > actually
>
> > > > does use EMA smoothing in computing the RSI. I state this for
>
> the
>
> > > > following reason.
>
> > > >
>
> > > > When I directly compare my spreadsheet calculations of RSI
>
> (where
>
> > > > EMAs are used but are computed recursively) with MS's results
>
> for
>
> > > SPY
>
> > > > from 1993 through the present (using a 14 bar period), the
>
> > greatest
>
> > > > percentage error is 0.0003%. On that basis, it most
definitely
>
> > > > appears that MS also uses EMAs in its internal calculation.
>
> > > >
>
> > > > I'm wondering if anyone among the MS development community is
>
> > > > participating in this group who can definitively state which
>
> > method
>
> > > > is used?
>
> > > >
>
> > > > KM
>
> > > >
>
> > > >
>
> > > > --- In equismetastock@ yahoogroups. com, pumrysh <no_reply@>
>
> wrote:
>
> > > > >
>
> > > > > Kenneth,
>
> > > > >
>
> > > > > The major flaw that I see with your code is the method of
>
> > > smoothing
>
> > > > > which should be Wilder's not Exponential. There are
literally
>
> > > > dozens
>
> > > > > of ways to write the code. You can find some here:
>
> > > > > http://trader. online.pl/ MSZ/e-0-tytulowa -r.html
>
> > > > > You may also search our archived messages and find a few
that
>
> > are
>
> > > > not
>
> > > > > there and may work even better.
>
> > > > >
>
> > > > > Preston
>
> > > > >
>
> > > > >
>
> > > > >
>
> > > > > --- In equismetastock@ yahoogroups. com, "antoinesax"
>
> > > <kennethmetz@ >
>
> > > > > wrote:
>
> > > > > >
>
> > > > > > Prior to exploring some variations for RSI, I thought it
>
> best
>
> > > to
>
> > > > > first
>
> > > > > > verify my own coding for this indicator in comparison
with
>
> > > > > MetaStock's
>
> > > > > > calculation.
>
> > > > > >
>
> > > > > > Much to my surprise, the results differed widely when
>
> applied
>
> > > to
>
> > > > > SPY
>
> > > > > > (from first data in 1993 through present date). Although
>
> > > > generally
>
> > > > > > zigging and zagging in the same direction, the two differ
>
> > > > > > significantly with ratio (my own code vs MS) varying from
>
> > > around
>
> > > > > 0.5
>
> > > > > > to 1.3.
>
> > > > > >
>
> > > > > > On the other hand, a spreadsheet version nearly matches
MS,
>
> > > > > suggestion
>
> > > > > > a problem in the MS coding. The only difference in the
two
>
> > > > versions
>
> > > > > is
>
> > > > > > that I used recursive formulas in the spreadsheet to
>
> > implement
>
> > > > the
>
> > > > > > EMA, whereas I simply used the Mov(C, N, E) function in
MS.
>
> > > > > >
>
> > > > > > Can someone point out the error in the code shown below?
>
> > > > > >
>
> > > > > >
>
> > > > > > Thanks,
>
> > > > > >
>
> > > > > > KM
>
> > > > > >
>
> > > > > > PS. Please note that the code uses the most logical
>
> > definition
>
> > > of
>
> > > > > RSI,
>
> > > > > > which is mathematcially equivalent to the standard
version
>
> > > using
>
> > > > RS
>
> > > > > > that was (maybe) computationally simpler three decades
ago
>
> > when
>
> > > > > this
>
> > > > > > indicator was invented...
>
> > > > > >
>
> > > > > >
>
> > > > > > ============ ========= ========= ========= ====
>
> > > > > >
>
> > > > > > Npds := Input("Periods" ,1,5000,14) ;
>
> > > > > > Chng := C - Ref(C,-1);
>
> > > > > > Adv := If(Chng>0,Chng, 0);
>
> > > > > > Dec := If(Chng<0,-Chng, 0);
>
> > > > > > AvgAdv := Mov(Adv,Npds, E);
>
> > > > > > AvgDec := Mov(Dec,Npds, E);
>
> > > > > > RSItest := 100*AvgAdv/( AvgAdv+AvgDec) ;
>
> > > > > >
>
> > > > > >
>
> > > > > > RSItest
>
> > > > > >
>
> > > > >
>
> > > >
>
> > >
>
> >
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> New Email names for you!
> Get the Email name you&#39;ve always wanted on the new @ymail and
@rocketmail.
> Hurry before someone else does!
> http://mail. promotions. yahoo.com/ newdomains/ sg/
>



New Email names for you!
Get the Email name you've always wanted on the new @ymail and @rocketmail.
Hurry before someone else does!

__._,_.___


Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___