QuoteTracker RSI Implementation Wrong?

Discussion in 'Technical Analysis' started by MisterGentleman, Jun 6, 2007.

  1. I was implementing an RSI indicator when I found that there are two different versions frequently attributed to J. Welles Wilder. The version described on Stochcharts.com seems to be the original Wilder version. By comparing the output from my implementation of this indicator I found that this is the version used by MetaStock. However, QuoteTracker seems to use a different version as its chart did not match my implantation or that in MetaStock.

    Searching around a bit more I found another definition of RSI on Wikipedia which is calculated using EMAs. I implemented this version and found it appeared to match QT for the first n periods but after that the results started to differ. I’ve compared my EMA class against QuoteTracker and found that it uses the same method to set the initial value, so the EMA is not the cause of the discrepancy and I can’t see any other issues. I’m therefore wondering if QT has not only implemented a variation of RSI that isn’t the true Wilder version but has also implemented it wrongly.

    I’d be very grateful if someone could confirm whether it’s me or QT that’s getting it wrong. Here’s my output for a 5 period RSI using the EMA version defined on Wikipedia:


    Here’s a 5 period RSI in QuoteTracker for the same data:


    As you can see QT seems to match my output for the first 5 periods but the results differ after that. It dips to nearly 50 at 09:35 while my results say 72.6. It’s also dead on 70 at 09:36 and 09:37 while my results say 78.1.

    So is QuoteTracker getting its RSI calculation wrong or is it me? Is it maybe using a third method that I haven’t seen?

    Thanks for any advice you can offer on this issue.
  2. I feel like a right Mr Confused now. I simply couldn't see anything wrong with my code but I'd completely overlooked something blindingly obvious. :eek:

    I'm a fool and should put chained up in the village square so people can throw rotten fruit at me for my stupidity. :(

    Sorry for any confusion.
  3. luxor


    Hi, what was wrong with your code. What formula do you use?
  4. It was something stupid. I’d initialised the EMA value to -1.0 which is why the value was coming out lower than in QuoteTracker for the first few periods. I have no idea at all why I’d set it to -1.0 and have even less idea why it took me so long to notice. The RSI calculation is such a simple piece of code that I’d convinced myself it couldn’t be wrong so wasn’t really looking hard enough and I didn’t look at the initiliser list. Like I say, I’m a fool :(

    The figures above (which are wrong) are for the version of RSI described on Wikipedia (using EMAs), which is the version used in QuoteTracker. I also implemented the original version of RSI, which is used in MetaStock and StockCharts.com but for my purposes I’ve found the QuoteTracker version is the better of the two (or the better of the three if you also count the Cutler version).

    Having made a fool of myself already I’m in no position to criticise, but I do feel it would be useful if QuoteTracker changed the name of RSI to something like RSI Using EMA to show it’s not the original version, since the behaviour is quite different from Wilder’s original RSI (it moves much faster than the Wilder version and doesn’t trend back to the centre when the price goes flat).