To: TechTrader42 who wrote (5 ) 2/3/1998 1:46:00 AM From: TechTrader42 Read Replies (1) | Respond to of 85
Based on its definition of RSI, it looks as though QP is not looking at the average change in price on up days and down days, but only on the "average number of days in the period when closing price was up," etc.: The formula for RSI is: RSI = 100 - ( 100 / ( 1 + RS ) ) Where RS is: (average # of days in the period when closing price was up from previous day) divided by (average # of days in the period when closing price was down from previous) So I would have thought that this would do it: output = "rsi.lst"; daystoload=2000; issuetype=common; exchange nyse,nasdaq,amex; float daysup, daysdown, newrsi; integer i, d; for d = 0 to 13 step 1 do daysup := 0; daysdown := 0; for i = 0 to -13 step -1 do if close(i-d) > close((i-1)-d) then daysup := (daysup +1); endif; if close(i-d) < close((i-1)-d) then daysdown:= (daysdown + 1); endif; next i; next d; newrsi:= 100-(100/(1+(daysup/(daysdown+.0000001)))); println Symbol:-6,",", "Days up: ", daysup:2:0, " Days down: ", daysdown:2:0, " RSI: ",rsi(0):3:3, " NEWRSI: ",newrsi:3:3; But it doesn't. If you take out "d," and just get the number of days up and the number of days down in the past 14 days, you get something close to QP's value with some stocks: output = "rsi.lst"; input = "portfoli.lst"; daystoload=2000; issuetype=common; exchange nyse,nasdaq,amex; float daysup, daysdown, newrsi; integer i; daysup := 0; daysdown := 0; for i = 0 to -13 step -1 do if close(i) > close(i-1) then daysup := (daysup +1); endif; if close(i) < close(i-1) then daysdown:= (daysdown + 1); endif; next i; newrsi:= 100-(100/(1+(daysup/(daysdown+.0000001)))); println Symbol:-6,",", "Days up: ", daysup:2:0, " Days down: ", daysdown:2:0, " RSI: ",rsi(0):3:3, " NEWRSI: ",newrsi:3:3; But I think it only works for some stocks because the formula is not really finding the average of the up days and down days, but just the number for that one period going back from today's close. My first formula in this note seeks to find the average, but that isn't succeeding, either. Anyway, I'm thinking to myself, out here on a patch of ice in the Arctic sea. Brooke