home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1993 #2
/
Image.iso
/
finance
/
tas515dm.zip
/
EXAMPLES.ZIP
/
TICKINDX.TAS
< prev
next >
Wrap
Text File
|
1993-05-02
|
8KB
|
183 lines
{TICKINDX.TAS Written 3/31/93 by Tom Rategan
Script produces price and volume graphs representing the cumulative
price and volume action of all stocks scanned in the ticker list. Good
indicator of the overall market or of any industry sector represented
by your ticker list.
The price graph was changed 5/1/93 to be unweighted. The price array
for each stock scanned is adjusted so that the first price is 100, and
all the following prices then proceed from the origin of 100. The adjusted
price arrays for each stock are added and at the end, averaged. So the
final price graph will always begin at 100 and proceed from there. Stocks
are "equalized" prior to being averaged in, so they are weighted equally
reguardless of their true share price. The old script simply averaged
all of the stocks prices, so naturally the action of the higher priced
stocks had more effect on the direction of the final graph. This version
also has the advantage that it is easy to figure the rate of change
of the average stock over the course of time which the graph displays,
because the starting value will always be 100.
The legend above the graph tells the number of stocks which were counted
in the survey. In parenthesis is shown the number which were skipped
due to lack of data. The "RG= XX%" compares today's high-to-low range
with the average range over the trailing 50 days. 100% indicates
average volatility, >100% is more volatility, and <100% less volatility.
"C is XX% of H" indicates where the close is relative to the high and
low. The formula is: ((close-low)/(high-low))*100. A value >50% indicates
that stocks closed closer to their highs on average, <50% means they
closed closer to their lows. This may be helpful in forshadowing the next
day's market action.
The volume graph shows what percentage of its trailing 50MA the
average stock traded that day. So it is effectively an unweighted graph,
as each stock is measured against its own 50MA. The legend also tells
how recent volume has been, averaging four of the trailing 5 day periods
and reporting them as W1, W2, W3, and W4. Advance and decline figures
were added to the volume graph 5/1/93, along with corresponding average
volume percentages for each group. The average price ((h+l+c)/3) is
used to determine whether stocks advanced or declined, so more stocks
will be included in either group than if the close alone were used.
An Acc-Dis graph was added 5/1/93. The graph is computed from the
final price/volume graphs. The indicator compares all volume on days
when the average price ((h+l+c)/3) was up to all volume on days when
average price was down, over the trailing 40 days. The sum of up and
down volume is averaged, and the down value is subtracted from the up
value. The result will be some value less than or greater than 0,
depending on whether there is selling or buying pressure.
You can control the number of days which are graphed by changing the
number in the #max_quotes line. The script will graph 50 days fewer than
the number in the #max_quotes line. The number should be some value
greater than 70. *Note- It is important that both the first ticker on
your list and the last ticker have sufficient data (the # in the
#max_quotes line) or else there will be no output. Also if you specify
a minimum price for stocks in line 54, the last ticker must be of an
adequate price so not to get skipped.
}
#max_quotes 305
{if c[0] < X then return;} {<< Remove the braces and give a value to X if
you want to skip stocks below a certain price}
if first_ticker then begin
cuml_hi : array;
cuml_lo : array;
cuml_cl : array;
cuml_vo : array;
minquotes = quote_count + 0;
skips = 0;
act = 0;
dct = 0;
avl = 0;
dvl = 0;
end;
if quote_count < minquotes then skips = skips + 1;
if quote_count < minquotes then return;
count = count + 1;
eqf = 100/c[50];
cuml_hi = add(mulby(h,eqf),cuml_hi);
cuml_lo = add(mulby(l,eqf),cuml_lo);
cuml_cl = add(mulby(c,eqf),cuml_cl);
nv : array;
nv = mulby(div(v,mov(v,50,'s')),100);
cuml_vo = add(nv,cuml_vo);
if (h[0]+l[0]+c[0])/3 > (h[-1]+l[-1]+c[-1])/3 then begin act = act + 1;
avl = avl + nv[0]; end;
if (h[0]+l[0]+c[0])/3 < (h[-1]+l[-1]+c[-1])/3 then begin dct = dct + 1;
dvl = dvl + nv[0]; end;
if last_ticker then goto addup else return;
:addup
cuml_vo = divby(cuml_vo,count);
cuml_hi = divby(cuml_hi,count);
cuml_lo = divby(cuml_lo,count);
cuml_cl = divby(cuml_cl,count);
x=1;
:redefine
x=x-1;
if x = -(quote_count) then goto nextstep;
h[x] = cuml_hi[x];
l[x] = cuml_lo[x];
c[x] = cuml_cl[x];
goto redefine;
:nextstep
chg = c[0] - c[-1];
pchg = (chg/c[-1])*100;
hiprc : array;
hiprc = hhv(c,quote_count-50);
oh = (1-(c[0]/hiprc[0]))*100;
trg : array;
trg = tr();
ar = sum(trg,50)/50;
rgt = (trg[0]/ar)*100;
ct = ((c[0]-l[0])/(h[0]-l[0]))*100;
ma50 : array;
ma50 = mov(c,50,'s');
v1= (cuml_vo[-1]+cuml_vo[-2]+cuml_vo[-3]+cuml_vo[-4]+cuml_vo[-5])/5;
v2= (cuml_vo[-6]+cuml_vo[-7]+cuml_vo[-8]+cuml_vo[-9]+cuml_vo[-10])/5;
v3= (cuml_vo[-11]+cuml_vo[-12]+cuml_vo[-13]+cuml_vo[-14]+cuml_vo[-15])/5;
v4= (cuml_vo[-16]+cuml_vo[-17]+cuml_vo[-18]+cuml_vo[-19]+cuml_vo[-20])/5;
acp = (act/count)*100;
dcp = (dct/count)*100;
acv = (avl/act);
dcv = (dvl/dct);
avp : array;
avp = avgprc();
up : array;
dn : array;
adl : array;
x = 1;
:make_uds
x=x-1;
if x <= -(quote_count-50) then cuml_vo[x] = 100;
if x = -(quote_count-1) then goto make_line;
if avp[x] > avp[x-1] then up[x] := cuml_vo[x] else up[x] := 0;
if avp[x] < avp[x-1] then dn[x] := cuml_vo[x] else dn[x] := 0;
goto make_uds;
:make_line
adl = sub(mov(up,40,'s'),mov(dn,40,'s'));
ud_chg= adl[0] - adl[-1];
da= -40;
np = 0;
:check_perc_zero
da = da + 1;
if da = 1 then goto perc_zero;
if adl[da]>=0 then np = np + 1;
goto check_perc_zero;
:perc_zero
p_one = (np/40)*100;
x_ago = 1;
:check_cross
x_ago = x_ago - 1;
if x_ago = -(quote_count-41) then goto ud50;
if adl[x_ago] >0 and adl[x_ago-1] <0 then goto ud50;
if adl[x_ago]<0 and adl[x_ago-1] >0 then goto ud50 else goto check_cross;
:ud50
if x_ago <> 0 then x_ago = -x_ago;
av = 0;
dv = 0;
d = 0;
:loop
gosub count;
if d = -51 then goto figure;
if c[d] < c[d+1] then av = av + cuml_vo[d+1];
if c[d] > c[d+1] then dv = dv + cuml_vo[d+1];
goto loop;
:count
d = d - 1;
return;
:figure
ud = av/dv;
opengraph(3,-(quote_count-49),0);
sizegraph(3,1,1);
graph(1,''+format(count,'%3.f')+' ('+format(skips,'%1.f')+
') '+format(c[0],'%2.2f')+' is '+format(oh,'%1.1f%')+
' off '+format(hiprc[0],'%2.2f')+' high. Chg= '+format(chg,'%1.2f')
+', '+format(pchg,'%1.2f%')+' Rg='+format(rgt,'%3.f%')
+' C'+format(ct,'%3.f%')+' of H.',ma50,'50MA');
graph(cuml_vo,'AV= '+format(cuml_vo[0],'%2.f%')
+' of 50MA. '+format(acp,'%2.f%')+' Adv, V= '+format(acv,'%2.f%')+
' '+format(dcp,'%2.f%')+' Dec, V= '+format(dcv,'%2.f%')+
' W1= '+format(v1,'%2.f%')+' W2= '+format(v2,'%2.f%')+
' W3= '+format(v3,'%2.f%')+' W4= '+format(v4,'%2.f%'));
drawline(7,0,100,0,100);
graph(adl,'40 A-D= '+format(adl[0],'%1.1f')+' Chg= '
+format(ud_chg,'%1.1f')+' Above Zero (40 Days)= '+format(p_one,'%2.f%')
+' Last Cross '+format(x_ago,'%1.f')+' Days Ago. 50 U/D= '
+format(ud,'%1.2f'));
drawline(7,0,0,0,0);
closegraph();