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

  1. {
  2. This script was written to find stocks which open higher than yesterday's
  3. high, or lower than yesterdays low, then trade higher or lower all day. This
  4. sort of "breakaway gap" is often the beginning of a larger trend.
  5. When it finds such situations, it will graph the stock and tell the size
  6. of the gap, the closing price and the all time high, as well as the percent
  7. off the high today's price is. The volume graph shows today's volume, the
  8. 50-day average volume, and today's as a percentage of the average.
  9. The volume graph also tells the average volume for the past 3 days, and
  10. compares this 3-day average volume to the 50-day average. This effectively
  11. shows how the short term volume trend compares to the larger trend.
  12. The screen then displays the same data during scanning. In addition, the
  13. script will show stocks which had a breakaway gap yesterday, or two days
  14. ago, reguardless of whether or not they had a gap today, because it is
  15. interesting to see if the price action follows up in the same direction.
  16. However, only stocks which had a gap today will be listed on the screen
  17. during processing. 30 day trading range is also shown on the graph.
  18. Written by Tom Rategan. Prodigy ID- PMGV10A
  19. }
  20. {Swapping braces on the following 2 lines directs output to file or printer}
  21. #output_file 'Gaps.lst'
  22. {#output_file lpt1.prn}
  23. {************************Print a Header**************************}
  24. if first_ticker then begin
  25. writeln
  26. ('            ********** Stocks With Breakaway Gaps TODAY *********');
  27. writeln
  28. ('   Name            Close    Change     Gap     %OH  %30Rng   Vol     %Vol'
  29. );
  30. writeln
  31. ('   ----            -----    ------     ---     ---  ------   ---     ----'
  32. );
  33. end;
  34. {***********************Find gaps********************************}
  35. if h[-1] < l[0] then goto g_up0;
  36. if l[-1] > h[0] then goto g_dn0;
  37. if h[-2] < l[-1] then goto g_up1;
  38. if l[-2] > h[-1] then goto g_dn1;
  39. if h[-3] < l[-2] then goto g_up2;
  40. if l[-3] > h[-2] then goto g_dn2 else return;
  41. {*****Determine size of gap and assign value to "days ago" variable****}
  42. :g_up0
  43. a:= 0;
  44. dist = l[0] - h[-1];
  45. gosub stats;
  46. goto listit;
  47. :g_dn0
  48. a:= 0;
  49. dist = l[-1] - h[0];
  50. gosub stats;
  51. goto listit;
  52. :g_up1
  53. a:= 1;
  54. dist = l[-1] - h[-2];
  55. gosub stats;
  56. goto graphit;
  57. :g_dn1
  58. a:= 1;
  59. dist = l[-2] - h[-1];
  60. gosub stats;
  61. goto graphit;
  62. :g_up2
  63. a:= 2;
  64. dist = l[-2] - h[-3];
  65. gosub stats;
  66. goto graphit;
  67. :g_dn2
  68. a:= 2;
  69. dist = l[-3] - h[-2];
  70. gosub stats;
  71. goto graphit;
  72. {*******Compute price and volume statistics******************}
  73. :stats
  74. hi_valqc : array;
  75. hi30 : array;
  76. lo30 : array;
  77. vo_val50 : array;
  78. qc = (quote_count - 2);
  79. hi30 = hhv(c,30);
  80. lo30 = llv(c,30);
  81. hi_valqc=hhv(c,qc);
  82. r30 = (1-(lo30/hi30)) * 100;
  83. oh=100-((c/hi_valqc)*100)
  84. vo_val50 = mov(v,50,'s');
  85. vo_val3 = ((v[0]+v[-1]+v[-2])/3);
  86. v_v50 = ((v[0]/vo_val50[0])*100);
  87. v3_v50 = ((vo_val3/vo_val50[0])*100);
  88. chg = c[0] - c[-1];
  89. return;
  90. {*******List those stocks with a gap TODAY to screen or  for printing***}
  91. :listit
  92. writeln(fullname,' ',c[0],' ',chg,' ',dist,' ',int(oh),'% ',int(r30),
  93. '% ',v,' ',int(v_v50),'%');
  94. {******Graph all stocks with a gap within past 3 days**************}
  95. :graphit
  96. opengraph(2);
  97. sizegraph(4,2);
  98. graph(1,''+format(c[0],'$%5.2f')+' is '+format(oh,'%5.2f%')
  99. +' off '+format(hi_valqc[0],'$%5.2f')+' high.   Gap= '
  100. +format(dist,'$%4.2f')+' '+format(a,'%1.f')+' days ago.   30 day range= '
  101. +format(r30,'%5.2f%'));
  102. graph(v,'Today='+format(v[0],'%5.f')+'   50MA='+format(vo_val50[0],'%5.f')
  103. +'   %Today='+format(v_v50,'%4.f%')+'   3MA='+format(vo_val3,'%5.f')
  104. +','+format(v3_v50,'%4.f%')+' of',vo_val50,'50MA');
  105. closegraph();
  106. return;
  107.