home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1993 #2
/
Image.iso
/
finance
/
tas515dm.zip
/
EXAMPLES.ZIP
/
GRAPHALL.TAS
< prev
next >
Wrap
Text File
|
1992-08-04
|
7KB
|
191 lines
{
A script written to simply graph all stocks in the ticker list. Good for
checking up on your current holds, or those which you are interested in
watching closely. It should be noted that the volume 5MA and 10MA
calculations do not include today, rather they end yesterday. They are
intended to show how volume has behaved in the one-week and two-week
periods immediately prior to today.
Written 3/28/92 by Tom Rategan. Prodigy PMGV10A.
*
Modified 08/03/92 to include optional up/down (U/D) volume ratio graph.
The U/D graph can be turned on or off by the user with the "switch" in
the first line of the script.
40 day ratio divides the total volume on days when the stock's average
price weighted toward the close ((H+L+C)/3) was higher than the previous
day, by the total volume on days the average price was lower. Attemps to
show whether a stock has been seeing accumulation or distribution.
The U/D graph is computed a unique way in this script. It attempts to show
accumulation and distribution effectively, while filtering out the
exagerations and distortions which U/D ratios can be subject to due
to periods of extreme volume.
40 days are used in computing the ratio. The "average price
weighted toward the close" ( (H+L+C)/3 ) is used to determine whether
the price was up or down from day to day. If a stock trades between
150% and 200% of its 40 day MA, the volume figure added to the up or
down side array is 150% of the 40 day MA. If more than 200% of the 40 day
MA is traded, then only 200% of the average volume is added to the
up side or the down side. In other words, there is a ceiling of 200%
of normal volume which can be used in the U/D calculation. If a stock
trades 300%, 700%, 1000% or more of its 40 day average volume, then
only 200% of the 40MA on the day the volume took place is added.
The legend on top of the U/D graph shows the current U/D, the change
from yesterday, the percent of time in the past 40 days the ratio was
greater than 1, and how many days ago the last cross of the 1 line
took place. The percent above 1 figure is helpful if the ratio has been
very close to the 1 line for awhile and it's difficult to tell which
side it has been on more of the time.
Also given in the U/D graph legend is the standard 50 U/D. This is the
simple ratio using only the close in determining whether price was up or
down, and with no filtering of extreme volume. This is the method which
Investor's Business Daily uses in its graphs, so I included it for
comparison.
The script will now graph any stock with at least 5 days of data. 50MA
and 200MA lines as well as the U/D graph are shown depending on whether
there is enough data. If there are fewer than 50 days of data, the volume
graph will make a moving average of the total number of days available
minus two.
}
UD_GRAPH_SWITCH = 1; { <<<< "0"= no U/D graph, "1"= U/D graph shown. }
if quote_count < 5 then return;
#max_quotes 305
less51 = 0;
less201 = 0;
if quote_count < 51 then less51 = 1
if quote_count < 51 then ud_graph_switch = 0;
if quote_count < 201 then less201 = 1;
qc = (quote_count-2);
hiqc : array;
hiqc = hhv(c,qc);
oh = (1-(c[0]/hiqc[0]))*100;
chg = c[0]-c[-1];
if less51 = 1 then goto vol;
hi30 : array;
lo30 : array;
hi30 = hhv(c,30);
lo30 = llv(c,30);
r30 = (1-(lo30/hi30))*100;
p50 : array;
p50 = mov(c,50,'s');
if c[0] >= p50[0] then off50 = (1-(p50[0]/c[0]))*100
else off50 = (1-(c[0]/p50[0]))*100;
if less201 = 1 then goto vol;
p200 : array;
p200 = mov(c,200,'s');
if c[0] >= p200[0] then off200 = (1-(p200[0]/c[0]))*100
else off200 = (1-(c[0]/p200[0]))*100
:vol
if less51 = 1 then goto shortvol_ma;
v50 : array;
v50 = mov(v,50,'s');
vv50 = (v[0]/v50[-1])*100;
v5 = (v[-1]+v[-2]+v[-3]+v[-4]+v[-5])/5;
v5v50 = (v5/v50[-1])*100;
v10 = (v[-1]+v[-2]+v[-3]+v[-4]+v[-5]+v[-6]+v[-7]+v[-8]+v[-9]+v[-10])/10;
v10v50 = (v10/v50[-1])*100;
goto ud_check;
:shortvol_ma
vx : array;
vx = mov(v,qc,'s');
vvx = (v[0]/vx[-1])*100;
:ud_check
if ud_graph_switch = 0 then goto graphit;
v40 : array;
v40 = mov(v,40,'s');
ud2:array;
up2:array;
dn2:array;
maup2:array;
madn2:array;
vo : array;
vo = v;
up2[1]:=0; dn2[1]:=0;
for j := 2; j<= quote_count; j:=j+1;
begin
if j < 40 then v40[j] = v40[1];
if vo[j] > (v40[j]*1.5) and vo[j] < (v40[j]*2) then vo[j] = (v40[j]*1.5);
if vo[j] >= (v40[j]*2) then vo[j] = (v40[j]*2);
if (h[j]+l[j]+c[j])/3 > (h[j-1]+l[j-1]+c[j-1])/3 then up2[j]:=vo[j] else
up2[j]:=0;
if (h[j]+l[j]+c[j])/3 < (h[j-1]+l[j-1]+c[j-1])/3 then dn2[j]:=vo[j] else
dn2[j]:=0
end;
maup2:=Mov(up2,40,'s');
madn2:=Mov(dn2,40,'s');
ud2:=div(maup2,madn2);
ud_chg= ud2[0] - ud2[-1];
da= -40;
np = 0;
:check_perc_one
da = da + 1;
if da = 1 then goto perc_one;
if ud2[da]>=1 then np = np + 1;
goto check_perc_one;
:perc_one
p_one = (np/40)*100;
x_ago = 1;
:check_cross
x_ago = x_ago - 1;
if ud2[x_ago] >1 and ud2[x_ago-1] <1 then goto ud50;
if ud2[x_ago]<1 and ud2[x_ago-1] >1 then goto ud50 else goto check_cross;
:ud50
if x_ago <> 0 then x_ago = -x_ago;
av = 0;
dv = 0;
d = -51;
:loop
gosub count;
if d = 0 then goto figure;
if c[d] < c[d+1] then av = av + v[d+1];
if c[d] > c[d+1] then dv = dv + v[d+1];
goto loop;
:count
d = d + 1;
return;
:figure
ud = av/dv;
:graphit
if ud_graph_switch = 1 then goto graph_ud;
opengraph(2,-255,0);
sizegraph(4,2);
goto graph_wo_ud;
:graph_ud
opengraph(3,-255,0);
sizegraph(3,1,1);
:graph_wo_ud
if less51 = 1 then goto graph_less51;
if less51 = 0 and less201 = 1 then goto graph_51_201;
graph(1,' '+format(c[0],'$%3.2f')+' is '+format(oh,'%2.1f%')+
' off '+format(hiqc[0],'$%3.2f')+' high. Change= '+format(chg,'$%2.2f')
+' 30 Range= '+format(r30,'%3.1f%'),p50,format(off50,'%2.f%')+
' off 50MA',p200,format(off200,'%2.f%')+' off 200MA');
goto graphvol;
:graph_51_201
graph(1,' '+format(c[0],'$%3.2f')+' is '+format(oh,'%2.1f%')+
' off '+format(hiqc[0],'$%3.2f')+' high. Change= '+format(chg,'$%2.2f')
+' 30 Range= '+format(r30,'%3.1f%'),p50,format(off50,'%2.f%')+
' off 50MA');goto graphvol;
:graph_less51
graph(1,' '+format(c[0],'$%3.2f')+' is '+format(oh,'%2.1f%')+
' off '+format(hiqc[0],'$%3.2f')+' high. Change= '+format(chg,'$%2.2f'));
:graphvol
if less51 = 1 then goto vol_less51;
graph(v,'Today='+format(v[0],'%5.f')+' 50MA='+format(v50[-1],'%5.f')
+' %Today='+format(vv50,'%4.f%')
+' 5MA= '+format(v5v50,'%3.f%')
+' of 50MA 10MA= '+format(v10v50,'%3.f%')+' of',v50,'50MA');
goto udgraph;
:vol_less51
graph(v,'Today='+format(v[0],'%5.f')+' '+format(qc,'%2.f')+' Day MA= '
+format(vx[-1],'%5.f')+' %Today='+format(vvx,'%4.f%'),vx,' '+
format(qc,'%2.f')+' Day MA');
:udgraph
if ud_graph_switch = 0 then goto close;
graph(ud2,'40 U/D= '+format(ud2[0],'%1.2f')+' Change= '
+format(ud_chg,'%0.2f')+' Above ONE (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,1,0,1);
:close
closegraph();
return;