StockFetcher Forums · General Discussion · Calculation of RSI(2)<< 1 2 >>Post Follow-up
contrahawk
68 posts
msg #47368
Ignore contrahawk
10/7/2006 5:58:22 PM

I need some direction, please. I'd like to calculate daily RSI(2). I have the general formula

RSI(N) = 100 - 100/[1 + RS(N)] where

RS(N) = [average of up closing changes in past N days] /
[average of down closing changes in past N days]

Here's my problem: specifically where RSI(2) is concerned, N = 2, and if the past two days have both had higher closes then

[average of down closing changes in the past 2 days] = 0,

RS(2) is undefinably large and RSI(2) = 100.

On the other hand, if the past two days have both had lower closes, then

[average of up closing changes in the past 2 days] = 0,

RS(2) = 0 and RSI(2) = 0.

Is there an alternative definition of RSI that takes care of this dilemma? Is there some convention that assigns minimum and maximum values to RS(N)? Can anyone help me? I'd be most grateful.

Jim



contrahawk
68 posts
msg #47373
Ignore contrahawk
10/8/2006 3:22:59 AM

I think perhaps I've found an answer to my question: use a 2 period EMA of the daily changes to calculate the RS [see formula in original post] rather than a simple average. So far so good, anyway -- this means that, for one issue, over the past two weeks, my calculations agree within rounding error with the values posted by SF and by Esignal.

Jim


gocats
22 posts
msg #47379
Ignore gocats
modified
10/8/2006 7:17:40 PM

That brings up another good point that I have been thinking of asking...how to calculate RSI(2) for the next day?

Let's say a particular stock's RSI(2) is 1.5 and my strategy is to buy when RSI(2) goes below 0.5, so by the current price, how can one calculate at what price next day will the RSI(2) be below 0.5?

Anyone?



contrahawk
68 posts
msg #47382
Ignore contrahawk
10/9/2006 2:54:36 AM

gocats,

use your spreadsheet program to set up an RSI(2) calculator. If your notion is to act on daily RSI(2) ringing the "Buy" bell, use it to calculate what daily RSI(2) would be for a spread of closing price values ranging from $2 below to $2 above today's close -- or whatever range fits your issue and program. Then if your issue hits a price level intraday tomorrow which would produce the trigger RSI(2). . . . .

Alternatively, subscribe to a service which provides streaming, real-time indicators [eSignal's MarketCenterLive is one].

Jim


gocats
22 posts
msg #47389
Ignore gocats
10/9/2006 1:45:38 PM

Well the reason I was asking is that I can't on the computer all the time since I have full time job. I can use RSI(2) to put a trade trigger at the price where I know RSI(2) will become 0.5 or whatever I decide.
Do you have a spreadsheet setup like that...I'm sorry, I'm not so good with Excel. Can you please share it with me?



rharmelink
81 posts
msg #47395
Ignore rharmelink
modified
10/10/2006 7:24:45 AM

Jim:

Unless you're talking about an RSI calculation that's different than the normal one, I think your problem is this assumption:

RS(N) = [average of up closing changes in past N days] /
[average of down closing changes in past N days]

That's ONLY for the first calculation of RS(N). See:

http://stockcharts.com/education/IndicatorAnalysis/indic_RSI.html

After the first calculation, you're dealing with a "smoothed" RS, which for an RSI(2) value is:

Current Average Gain = (1 * Previous Average Gain + (Current Day Gain | 0)) / 2
Current Average Loss = (1 * Previous Average Loss + (Current Day Loss | 0)) / 2

RS() = Current Average Gain / Current Average Loss

...which means what you really need to know are the previous intermediate calculations of the Average Gain and Average Loss, not the previous RS or RSI.

If my algebra is correct, this is the calulation of a loss required for a lower RSI value:

L = AL - (AG / (100 / (100 - RSI) - 1))

...and this is the calculation for the gain required for a higher RSI value:

G = AL * (100 / (100 - RSI) - 1) - AG

...where:

AL = Average Loss from previous day
AG = Average Gain from previous day
RSI = Desired RSI value
L = Necessary loss for today to achieve RSI value
G = Necessary gain for today to achieve RSI value

If G evaluates as negative or L evaluates to positive, it means the RSI value you are looking for cannot be achieved with a price change in that direction.



contrahawk
68 posts
msg #47396
Ignore contrahawk
10/10/2006 9:27:15 AM

rharmelink,

First, thanks for working on my quandry.

Second, I had come to the point of deciding that at least a working approximation is

today's average "up" = (today's up change + yesterday's average "up") / 2

and

today's average "down" = (today's down change + yesterday's average "down") / 2

I selected a starting day where the day's result was opposite in algebraic sign from the prior day -- to avoid an initial division by zero -- and those simple averages were my first "yesterday's average 'up'" and "yesterday's average 'down'".

Within 4 - 5 days of beginning the calculation, my result matches that of SF.

Again, my thanks! I appreciate the link to stockcharts.com, too.

Jim


marine2
963 posts
msg #47406
Ignore marine2
10/10/2006 8:16:54 PM

I wanna be a RSI(2) nerd lol, just kidding. You people are way above my level. As MC Hammer would say: "You cant touch this" (you normal people).


gocats
22 posts
msg #47441
Ignore gocats
10/13/2006 2:06:32 AM

rharmelink:

I have trying your formula on so many stocks for the last 2 days but haven't been able to figure out the right results.
L = AL - (AG / (100 / (100 - RSI) - 1))

Actually none of them matches with what I see on SF or any other site.

Let's take EZPW as an example. On 10/2/2006, the RSI(2) was 84.4. Next day (10/3) the RSI(2) became 5.1. So to achieve 5.1, let's insert in the formula:

L = AL - (AG / (100 / (100 - 5.1) - 1))

Here
AL = (0.03/2) = 0.015 (In the last 2 days there was one red day and fell $0.03)
AG = (0.12/2) = 0.06 (In the last 2 days there was one Green day and rose $0.12)

L = 0.015 - (0.06/ (100 / (100 - 5.1) - 1))

L = -1.1

But if you see the stock fell $2.38 to achieve RSI(2) of 5.1.

So please tell me what I am doing wrong.

Thanks


contrahawk
68 posts
msg #47442
Ignore contrahawk
modified
10/13/2006 9:00:45 AM

gocats,

See if this gives you any leads. This is for GOOG. It does not follow the calculation you've been working with, but it does produce an accurate RSI(2).

Date DOW Close Day Chg, $ UP today DN today abs DN today avg UP(2) avg DN(2) RS(2) Fraction RSI(2)
09/26/06 Tu 406.87 2.89 2.89 0.00 0.00
09/27/06 W 402.92 (3.95) 0.00 (3.95) 3.95 1.45 1.97 0.73 57.75 42.25
09/28/06 Th 403.58 0.66 0.66 0.00 0.00 1.05 0.99 1.07 48.41 51.59
09/29/06 F 401.90 (1.68) 0.00 (1.68) 1.68 0.53 1.33 0.39 71.71 28.29
10/02/06 M 401.44 (0.46) 0.00 (0.46) 0.46 0.26 0.90 0.29 77.32 22.68
10/03/06 Tu 404.04 2.60 2.60 0.00 0.00 1.43 0.45 3.19 23.85 76.15
10/04/06 W 415.70 11.66 11.66 0.00 0.00 6.55 0.22 29.19 3.31 96.69
10/05/06 Th 411.81 (3.89) 0.00 (3.89) 3.89 3.27 2.06 1.59 38.59 61.41
10/06/06 F 420.50 8.69 8.69 0.00 0.00 5.98 1.03 5.82 14.67 85.33
10/09/06 M 429.00 8.50 8.50 0.00 0.00 7.24 0.51 14.08 6.63 93.37
10/10/06 Tu 426.65 (2.35) 0.00 (2.35) 2.35 3.62 1.43 2.53 28.35 71.65
10/11/06 W 426.50 (0.15) 0.00 (0.15) 0.15 1.81 0.79 2.29 30.41 69.59
10/12/06 Th 427.44 0.94 0.94 0.00 0.00 1.38 0.40 3.48 22.34 77.66
10/13/06 F

today's "avg UP(2)" = [yesterday's avg UP(2) + UP today] / 2

similarly for "avg DN(2)"

"RS(2)" and "Fraction" are from the defining expression for RSI

Jim






StockFetcher Forums · General Discussion · Calculation of RSI(2)<< 1 2 >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.