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

Re: [EquisMetaStock Group] correct method of calculating RSI



PureBytes Links

Trading Reference Links

------------------------------------------------------------------------
You cannot reply to this message via email because you have chosen not
to disclose your email address to the group.

To reply:  http://groups.yahoo.com/group/equismetastock/post?act=reply&messageNum=6104
------------------------------------------------------------------------

I used the Welles Wilder formula as given in his book. As the Equis site 
explains, it is difficult to interpret without reading his book. see 
http://www.equis.com/Education/TAAZ/?page=100

Basically it says add up the up difference between the closing prices of up 
days and down days. After the initial 10 days (if you are after RSI(10)), 
then multiply the total by 9, add in the movement and divide by10. Do this 
for both up and down values. Divide Up total by down total, add 1, divide 
100 by this value, and subtract this new value from 100.
The following procedure calcultes RSI(10).
I initially read all day close values into an array DayClose, until I 
reached the day I wanted to calculate the RSI for. The no of trading days 
from start of reading the data in, in my case from 1/1/98 until day required 
gives MaxRecordCount.

For days 1 to 10 just add up up or down, then divide both values by 10 and 
divide by 9.
then
If the next day close is up, add the difference to the up subtotal,
if down, add the difference to the down total.


In the VB procedure, the line

150 If DayClose(P) = DayClose(P - 1) Then GoTo 200

is the critical line.
If it is included, you get the values as calculated by Bourse.
If you leave it out, you get the values calculated by MS.


RSI10(P)is the RSI on any given day.


Hope this explains the method and calculations.

Mike Slattery




Public Sub CalcRSI10()
RUp = 0
RDown = 0

For P = 1 To 10
If DayClose(P) > DayClose(P - 1) Then RUp = RUp + (DayClose(P) - DayClose(P 
- 1))
If DayClose(P) < DayClose(P - 1) Then RDown = RDown + (DayClose(P - 1) - 
DayClose(P))

Next P


RUp = RUp / 10
RDown = RDown / 10

If RUp = 0 Then GoTo 100
If RDown = 0 Then GoTo 100

t = RUp / RDown

t = t + 1
t = 100 / t

t = 100 - t

100 For P = 11 To MaxRecordCount

150 If DayClose(P) = DayClose(P - 1) Then GoTo 200

RUp = RUp * 9
RDown = RDown * 9

If DayClose(P) > DayClose(P - 1) Then RUp = RUp + (DayClose(P) - DayClose(P 
- 1))
If DayClose(P) < DayClose(P - 1) Then RDown = RDown + (DayClose(P - 1) - 
DayClose(P))


RUp = RUp / 10
RDown = RDown / 10

If RUp = 0 Then GoTo 200
If RDown = 0 Then GoTo 200

t = RUp / RDown

t = t + 1
t = 100 / t

t = 100 - t

200 RSI10(P) = t
Next P

Exit Sub

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
http://join.msn.com/?page=features/virus


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/