home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1993 #2
/
Image.iso
/
finance
/
tas515dm.zip
/
EXAMPLES.ZIP
/
BBANDX.TAS
< prev
next >
Wrap
Text File
|
1992-03-02
|
3KB
|
93 lines
{ BBAND.TAS - This script computes BOLLINGER BANDS.
Bollinger bands are lines which are 'n' standard deviations away
from a 'p' day moving average of the close.
To change the value of 'n', change 'bband_devs' below. To
change the value of 'p', change 'bband_period' below.
NOTE- This script will use the optional GRAPH feature of TAS.
If it is not registered to run GRAPH's then it will terminate
on the SECOND graph.
If you wish to continue viewing graphs, see the REGISTER.DOC
file included with the TAS system. That file contains the
pricing and ordering information for the GRAPH feature.
-
-
*Script modified 2/27/92 by Tom Rategan. Graph now tells Close, Change,
High, % Off High, and 30 Day Trading Range. Volume Graph tells Volume,
50-day Average Volume, % Today vs Average, prior 7 day average, and
7 day vs 50 day %. The 7 day average does not include today, rather it
averages volume between yesterday and 8 days ago. BBand breakouts are
often accompanied by high volume and so including today's volume may
obscure the 7 day average. The 7 day average tries to show how volume
recently compares with the longer average.
Screen displays most of the same data during scanning.
}
#output_file 'bband.lst' n
if first_ticker then begin
writeln
(' Name Close Change BO Dir %OH %30Rng Vol %Vol'
);
writeln
(' ---- ----- ------ ------ --- ------ --- ----'
);
end;
GRAPH_SWITCH = 1; {<--------- SET THIS TO 1 TO SEE GRAPHS}
bband_period = 20; { number of days in BBAND period }
bband_devs = 2; { number of STD DEVIATIONS about close}
bband_top : array; { top band }
bband_bot : array; { bottom band }
{
Top Bollinger Band
}
bband_top = bbandt(20,2);
{
Bottom Bollinger Band
}
bband_bot = bbandb(20,2);
{ Now, the rest is up to you. I have suppied a simple check to see
if the current close is over the top band or below the bottom band.
You can use these BBAND arrays to check for the narrowing of the
bands, tops or bottoms outside the bands, and bouncing off the
bands.
}
if over(c,bband_top) <= 0 then
begin
gosub dograph;
writeln(fullname,' ',c[0],' ',chg,' Upward ',int(oh),'% ',int(r30),'% '
,v,' ',int(v_v50),'%');
end;
if over(bband_bot,c) <= 0 then
begin
gosub dograph;
writeln(fullname,' ',c[0],' ',chg,' Dnward ',int(oh),'% ',int(r30),'% '
,v,' ',int(v_v50),'%');
end;
return;
:dograph
hivalqc : array;
hi30 : array;
lo30 : array;
v50 : array;
qc = (quote_count - 2);
hi30 = hhv(c,30);
lo30 = llv(c,30);
hivalqc = hhv(c,qc);
r30 = (1-(lo30/hi30))*100;
oh = 100-((c/hivalqc)*100);
v50 = mov(v,50,'s');
v7 = ((v[-1]+v[-2]+v[-3]+v[-4]+v[-5]+v[-6]+v[-7])/7)
v_v50 =((v[0]/v50[0])* 100);
v7_v50 = ((v7/v50[0])*100);
chg = c[0] - c[-1];
if graph_switch = 0 then return;
opengraph(2);
sizegraph(4,2); { size the graphs 2/3, 1/3}
graph(1,''+format(c[0],'$%5.2f')+' is '
+format(oh,'%5.2f%')+' off '+format(hivalqc[0],'$%5.2f')
+' high. Change= '+format(chg,'$%2.2f')+' 30 day range= '
+format(r30,'%2.2f%'),bband_top,bband_bot,);
graph(v,'Today='+format(v[0],'%5.f')+' 50MA='+format(v50[0],'%5.f')
+' %Today='+format(v_v50,'%4.f%')+' Prior 7MA='+format(v7,'%5.f')
+','+format(v7_v50,'%4.f%')+' of',v50,'50MA');
closegraph();
return;