Re: iRSI implementation issue

Questions and Answers

iRSI implementation issue


anatolik 01-04-2007, 1:31 PM
Hi,

It looks like there is a bug in iRSI class Relative Strength Index (RSI) calculation. In the source code I see the following expression for smoothed RS calculation:

RS = (((prevGain*(Periods-1))+AvgGain)/Periods) / ((((prevLoss*(Periods-1))+AvgLoss)/Periods));

Usually smoothed RS is calculated using the following formula:

Smoothed RS = ((previousAvgGain*(Periods-1)+CurrentGain)/Periods) / ((previousAvgLoss*(Periods-1)+CurrentLoss)/Periods)

So there must be Current Gain/Loss instead of AvgGain/AvgLoss in the source code (Indicators.cs, line 830).

Regards,
Anatoli

Re: iRSI implementation issue


asimon 01-14-2007, 9:12 PM

Yes, I see the discrepancy in the formula in Indicators.cs, line 830 and the formula at http://stockcharts.com/education/IndicatorAnalysis/indic_RSI.html

To fix this error, the class will have to be reworked with the circular queue class instead of a simple array to keep the current gain synchronized with the previous average gain value.

Thanks for bringing this issue to light.

Re: iRSI implementation issue


JoeMama 06-20-2007, 2:33 PM
Any Luck on Updating this Issue. I would like to use this indicator, but I have no idea how to fix this problem.

Re: iRSI implementation issue


asimon 07-07-2007, 9:21 AM
I expect the solution to this problem to be submitted by a forum user. The user who submits such a contribution gets access to the source code forum.

Re: iRSI implementation issue


bennean 03-09-2009, 11:45 AM
Is this source code still being maintained? It's now March 2009 and the RSI bug is still there, and I'm surprised it hasn't been fixed by now. I guess I'll have a look at it myself...

Re: iRSI implementation issue


davidjjon 03-09-2009, 4:28 PM
Hi bennean,

It does not look like this code is being maintained; however, I am working with source.

I am interested in what development you are doing JK @ SoftwareByDavid.com

David Roh

Re: iRSI implementation issue


bennean 03-10-2009, 3:08 AM

I'm looking at Technical Analysis in the context of betting exchanges. 4XLab seemed to offer a whole bunch of indicators, but I've found a bug in EMA and now RSI. Like they say, there's no such thing as a free lunch!
Forex Lab .NET | 4X Lab .NET © Copyright 2005-2006 ASCSE LLC | Disclaimer

Powered by Community Server, by Telligent Systems