SI
SI
discoversearch

We've detected that you're using an ad content blocking browser plug-in or feature. Ads provide a critical source of revenue to the continued operation of Silicon Investor.  We ask that you disable ad blocking while on Silicon Investor in the best interests of our community.  If you are not using an ad blocker but are still receiving this message, make sure your browser's tracking protection is set to the 'standard' level.
Strategies & Market Trends : TA-Quote Plus Version 2.0 -- Ignore unavailable to you. Want to Upgrade?


To: TechTrader42 who wrote (10)2/3/1998 9:39:00 PM
From: TechTrader42  Read Replies (1) | Respond to of 85
 
Here's one effort to formulate RSI, based on the formula:

rsi:= 100-(100/(1+rs));

The scan is below, but it doesn't give values matching those in QP's data window, Wow and Metastock. I thought the problem might be that it's only calculating average price changes on up and down days, but not a moving average of average price changes on up down days, but I tried it with the moving average, too, and that scan didn't give the right values, either. The scans are:

output = "ma.lst";
input = "portfoli.lst";

daystoload=2000;

issuetype=common;
exchange nyse,nasdaq,amex;

float plus, minus, newrsi, rs;

integer i;

plus:=0;
minus:=0;
for i = 0 to -13 step -1 do
if close(i)>close(i-1) then
plus:= plus + (close(i)-close(i-1))/14;
endif;

if close(i) < close(i-1) then
minus:= minus + abs(close(i)-close(i-1))/14;
endif;

next i;

rs:=plus/(minus+.000000001);

newrsi:= 100-(100/(1+rs));

println Symbol:-6,",", "Plus: ", plus, "Minus: ", minus:6:3, "Newrsi: ", newrsi:6:3;

***********************

The next scan is basically the same, except for the fact that it calculates moving averages of average price changes on up and down days (moving averages of "plus" and "minus").

output="ma.lst";
input="portfoli.lst";

daystoload=500;

issuetype=common;
exchange nyse,nasdaq,amex;

float plus, minus, newrsi, rs;

integer i, d;

plus:=0;
minus:=0;

for d = 0 to 13 step 1 do
for i = (0) to (-13) step -1 do
if close(i)>close(i-1) then
plus:= plus + (close(i)-close(i-1));
endif;

if close(i) < close(i-1) then
minus:= minus + abs(close(i)-close(i-1));
endif;

next i;
next d;

rs:=plus/(minus+.000000001);

newrsi:= 100-(100/(1+rs));

println Symbol:-6,",", "Plus: ", plus, "Minus: ", minus:6:3, "Newrsi: ", newrsi:6:3;

***************************

The moving average of average price changes amounts to a moving average of a moving average. The formula I used for that is below. I checked this formula for an MA of an MA with closing prices, and compared it to the results from this formula in Wow and Metastock: mov(mov(c,14,s),14,s). The values are the same. Here's the formula:

output = "moma.lst";

//moving average of moving average, by Brooke

daystoload=2000;

issuetype=common;
exchange nyse,nasdaq,amex;

float ma, moma, period;

integer i, d;

period:=14;

ma:=0;
for d = 0 to period-1 step 1 do

for i = (0-d) to (-(period-1)-d) step -1 do
ma:= ma + close(i)/period;

moma:=ma/period;

next i;
next d;

println Symbol:-6,",", "Moving average of moving average: ", moma;