home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / finance / tas515dm.zip / EXAMPLES.ZIP / DAMPING.TAS < prev    next >
Text File  |  1992-06-20  |  4KB  |  113 lines

  1. {DAMPING.TAS Version 1}
  2. {*****************************************************************}
  3. {                          Description
  4. ******************************************************************
  5. 1. Based on The Damping Index - Tech. Ana. of Stocks & Commodities
  6.    July 1992 - Author Curtis McKallip
  7. {}{
  8.                    (Avg. High[-1] to [-6])-(Avg. Low[-1] to [-6])
  9. 2. Damping Index = ----------------------------------------------
  10.                    (Avg. High[-6] to [-10])-(Avg. Low[-6] to [-10]
  11. }{
  12. 3. The Damping Index indicates when below 1 that the highs and lows
  13.    are getting closer together.
  14. 4. A Buy signal is given when DI<1 and the close of today is greater
  15.    than the average high of the preceding two bars and the average low
  16.    of the last three bars is greater than the average high of the 4 bars
  17.    starting 10 bars ago.
  18. 5. A Sell signal is given when DI<1 and the close of today is less than
  19.    the average low of the last two bars and the average high of the last
  20.    three bars is less than the average low of four bars starting 10 bars
  21.    ago.
  22. }{}
  23. {THIS HAS NOT BEEN PUT THRU PROFIT TEST - IT'S ONLY FROM THE ARTICLE}
  24. {}
  25. {written by => STEVE HEDLUND
  26. date       => 06/20/92}
  27. {}
  28. {*****************************************************************
  29.                          Set Standards
  30. ******************************************************************}
  31. #max_quotes 100
  32. MQ=100;                    {SET THE SAME AS MAX_QUOTES}
  33. FP=5;                      {NUMBER OF PERIODS FOR AVERAGES}
  34. GR=1;                     {SET TO 0 NOT TO GRAPH}
  35. #output_file DAMPING.LST
  36. {*****************************************************************}
  37. {                        Initial Checks                           }
  38. {*****************************************************************}
  39. if quote_count<mq then return;
  40. {*****************************************************************}
  41. {                         Write Heading                           }
  42. {*****************************************************************}
  43. if first_ticker then
  44. begin
  45. writeln('Symbol        Name       Signal ');
  46. writeln('------  ---------------- ------- ');
  47. end;
  48. {*****************************************************************}
  49. {                        Create Arrays                            }
  50. {*****************************************************************}
  51.      HP1 : array;
  52.      HP2 : array;
  53.      LP1 : array;
  54.      LP2 : array;
  55.      FN1 : array;
  56.      FN2 : array;
  57.      DIN : array;
  58. {*****************************************************************}
  59. {                      Calculate Equations                         }
  60. {*****************************************************************}
  61. For i=10;i<=mq;i=i+1;
  62. begin
  63. hp1[i]=(h[i]+h[i-1]+h[i-2]+h[i-3]+h[i-4])/5;
  64. lp1[i]=(l[i]+l[i-1]+l[i-2]+l[i-3]+l[i-4])/5;
  65. hp2[i]=(h[i-5]+h[i-6]+h[i-7]+h[i-8]+h[i-9])/5;
  66. lp2[i]=(l[i-5]+l[i-6]+l[i-7]+l[i-8]+l[i-9])/5;
  67. din[i]=(hp1[i]-lp1[i])/(hp2[i]-lp2[i]);
  68. end;
  69. {dump_array(h,l,hp1,hp2,lp1,lp2,din); Used only for testing}
  70. {*****************************************************************}
  71. {                 Check Conditions for Buy                        }
  72. {*****************************************************************}
  73. if din[-1]>=1 and din[0]<1 then gosub bcon1;
  74. return;
  75. :bcon1
  76. if h[0]>((h[-1]+h[-2])/2) then gosub bcon2;
  77. gosub scon1;
  78. return;
  79. :bcon2
  80. if ((l[-1]+l[-2]+l[-3])/3)>((h[-7]+h[-8]+h[-9]+h[-10])/4) then gosub bgrap;
  81. return;
  82. :bgrap
  83. if gr=1 then
  84. begin
  85. opengraph(2,-85);
  86. SIZEGRAPH(2,1);
  87. graph(1,BBANDB(21,2),BBANDT(21,2),'** BUY **')
  88. graph(DIN,'Damping Index');
  89. closegraph();
  90. end;
  91. writeln(ticker,fullname,' ','* BUY *');
  92. return;
  93. {*****************************************************************}
  94. {                 Check Conditions for Sell                       }
  95. {*****************************************************************}
  96. :scon1
  97. if l[0]<((l[-1]+l[-2])/2) then gosub scon2;
  98. return;
  99. :scon2
  100. if ((h[-1]+h[-2]+h[-3])/3)<((l[-7]+l[-8]+l[-9]+l[-10])/4) then gosub sgrap;
  101. return;
  102. :sgrap
  103. if gr=1 then
  104. begin
  105. opengraph(2,-85);
  106. SIZEGRAPH(2,1);
  107. graph(1,BBANDT(21,2),'** SELL **',BBANDB(21,2));
  108. graph(DIN,'Damping Index');
  109. closegraph();
  110. end;
  111. writeln(ticker,fullname,' ','* Sell*');
  112. return;
  113.