home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1993 #2
/
Image.iso
/
finance
/
tas515dm.zip
/
EXAMPLES.ZIP
/
DAMPING.TAS
< prev
next >
Wrap
Text File
|
1992-06-20
|
4KB
|
113 lines
{DAMPING.TAS Version 1}
{*****************************************************************}
{ Description
******************************************************************
1. Based on The Damping Index - Tech. Ana. of Stocks & Commodities
July 1992 - Author Curtis McKallip
{}{
(Avg. High[-1] to [-6])-(Avg. Low[-1] to [-6])
2. Damping Index = ----------------------------------------------
(Avg. High[-6] to [-10])-(Avg. Low[-6] to [-10]
}{
3. The Damping Index indicates when below 1 that the highs and lows
are getting closer together.
4. A Buy signal is given when DI<1 and the close of today is greater
than the average high of the preceding two bars and the average low
of the last three bars is greater than the average high of the 4 bars
starting 10 bars ago.
5. A Sell signal is given when DI<1 and the close of today is less than
the average low of the last two bars and the average high of the last
three bars is less than the average low of four bars starting 10 bars
ago.
}{}
{THIS HAS NOT BEEN PUT THRU PROFIT TEST - IT'S ONLY FROM THE ARTICLE}
{}
{written by => STEVE HEDLUND
date => 06/20/92}
{}
{*****************************************************************
Set Standards
******************************************************************}
#max_quotes 100
MQ=100; {SET THE SAME AS MAX_QUOTES}
FP=5; {NUMBER OF PERIODS FOR AVERAGES}
GR=1; {SET TO 0 NOT TO GRAPH}
#output_file DAMPING.LST
{*****************************************************************}
{ Initial Checks }
{*****************************************************************}
if quote_count<mq then return;
{*****************************************************************}
{ Write Heading }
{*****************************************************************}
if first_ticker then
begin
writeln('Symbol Name Signal ');
writeln('------ ---------------- ------- ');
end;
{*****************************************************************}
{ Create Arrays }
{*****************************************************************}
HP1 : array;
HP2 : array;
LP1 : array;
LP2 : array;
FN1 : array;
FN2 : array;
DIN : array;
{*****************************************************************}
{ Calculate Equations }
{*****************************************************************}
For i=10;i<=mq;i=i+1;
begin
hp1[i]=(h[i]+h[i-1]+h[i-2]+h[i-3]+h[i-4])/5;
lp1[i]=(l[i]+l[i-1]+l[i-2]+l[i-3]+l[i-4])/5;
hp2[i]=(h[i-5]+h[i-6]+h[i-7]+h[i-8]+h[i-9])/5;
lp2[i]=(l[i-5]+l[i-6]+l[i-7]+l[i-8]+l[i-9])/5;
din[i]=(hp1[i]-lp1[i])/(hp2[i]-lp2[i]);
end;
{dump_array(h,l,hp1,hp2,lp1,lp2,din); Used only for testing}
{*****************************************************************}
{ Check Conditions for Buy }
{*****************************************************************}
if din[-1]>=1 and din[0]<1 then gosub bcon1;
return;
:bcon1
if h[0]>((h[-1]+h[-2])/2) then gosub bcon2;
gosub scon1;
return;
:bcon2
if ((l[-1]+l[-2]+l[-3])/3)>((h[-7]+h[-8]+h[-9]+h[-10])/4) then gosub bgrap;
return;
:bgrap
if gr=1 then
begin
opengraph(2,-85);
SIZEGRAPH(2,1);
graph(1,BBANDB(21,2),BBANDT(21,2),'** BUY **')
graph(DIN,'Damping Index');
closegraph();
end;
writeln(ticker,fullname,' ','* BUY *');
return;
{*****************************************************************}
{ Check Conditions for Sell }
{*****************************************************************}
:scon1
if l[0]<((l[-1]+l[-2])/2) then gosub scon2;
return;
:scon2
if ((h[-1]+h[-2]+h[-3])/3)<((l[-7]+l[-8]+l[-9]+l[-10])/4) then gosub sgrap;
return;
:sgrap
if gr=1 then
begin
opengraph(2,-85);
SIZEGRAPH(2,1);
graph(1,BBANDT(21,2),'** SELL **',BBANDB(21,2));
graph(DIN,'Damping Index');
closegraph();
end;
writeln(ticker,fullname,' ','* Sell*');
return;