home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / finance / tas515dm.zip / EXAMPLES.ZIP / BASE_HIC.TAS < prev    next >
Text File  |  1992-03-30  |  9KB  |  221 lines

  1. {BASE_HIC.TAS => BASE-NH.LST  TAS408d
  2.      This script is geared toward investors who like
  3.      to buy stocks at or near new highs, as they emerge
  4.      from basing patterns. It finds and graphs all stocks
  5.      which are making new highs, and all stocks which are
  6.      within 5% of their high AND have been in a narrow
  7.      trading range for a period of time.
  8.      The graph of the stock appears on the screen and any
  9.      base found is defined with red lines. Stocks making
  10.      new highs will not always show base lines. The "base"
  11.      shown in the legend on top of the price graph tells how
  12.      many days the stock has traded within 15%.
  13.      The volume graph plots the 50 day moving average and
  14.      tells how today's volume compares with the 50MA. The
  15.      5MA and 10MA comparisons are also shown. The 5MA and
  16.      10MA calculations do not include today, rather they
  17.      end yesterday. They attempt to show how volume behaved
  18.      immediately prior to today's action.
  19.      Most data is displayed on the screen during processing,
  20.      and it is saved in the output file "BASE-NH.LST".
  21. Written 3/18/92 by Tom Rategan.  Prodigy PMGV10A
  22.      Modifications made to include a for loop to find the
  23.      range and a second page of graphs.
  24. Modified 3/18/92 Jerry Green
  25.      Summary report added.
  26. Modified 3/27/92 Jerry Green
  27.      Switches have been added so that in order to see
  28.      graphs or the full report you must set the switches
  29.      to 1.  The summary will always be printed.
  30. Modified 3/29/92 Jerry Green
  31. }
  32. #max_quotes 255
  33. #output_file 'BASE-NH.LST'
  34. if first_ticker and Full_Report = 1 then
  35. begin
  36. writeln(
  37. '      ********* New highs and possible near base breakouts. *********
  38. ');
  39. writeln(
  40. '                                         All Time |--Base--|');
  41. writeln(
  42. '    Name           Close    Change   %OH   High   %Rng  Days   Vol   %V'
  43. );
  44. writeln(
  45. '    ----           -----    ------   ---   ----   ----  ----   ---   --'
  46. );
  47. end;
  48. {**********************************************************}
  49. {                     Count Tickers                        }
  50. {**********************************************************}
  51.                 tick_count = tick_count + 1;
  52. {**********************************************************}
  53. {                     Declare Arrays                       }
  54. {**********************************************************}
  55.                      lorg : array;
  56.                      hirg : array;
  57.                      vo50 : array;
  58. {**********************************************************}
  59. {                     Set Switches                         }
  60. {**********************************************************}
  61. {
  62.     To set switches, or turn on a function, from dos type
  63.     TAS BASE_HIC 'TICKERLIST' @Graph1 = 1;Full_Report = 1
  64.     or set the switches while in the editor. The summary
  65.     will always print.
  66. }
  67.  if Graph1      = 0 then Graph1      =    0;
  68.  if Graph2      = 0 then Graph2      =    0;
  69.  if Full_Report = 0 then Full_Report =    0;
  70. {**********************************************************}
  71. {                   Do  Some  Filtering                    }
  72. {**********************************************************}
  73.              if quote_count < 65 then gosub Summary;
  74.              qc = (quote_count-2);
  75.              hiqc = hhv(c,qc);
  76.              hipcnt = hiqc * .85;
  77.              if c >= hiqc then
  78.                 newhigh_switch = 1;
  79.                else
  80.                 newhigh_switch = 0;
  81.              if c < (hiqc * .95)
  82.              and newhigh_switch = 0
  83.              then gosub Summary;
  84. {**********************************************************}
  85. {                    Filter and Count                      }
  86. {**********************************************************}
  87.              hi30 = hhv(c,30);
  88.              lo30 = llv(c,30);
  89.              r30 = (1-(lo30/hi30))*100;
  90.              if r30 > 15 and
  91.              newhigh_switch = 0 then
  92.                gosub Summary
  93.               else
  94.                count_15 = count_15 + 1;
  95.              if r30 < 10  then
  96.                count_10 = count_10 + 1;
  97.              if r30 < 5 then
  98.                count_5 = count_5 + 1;
  99.              if newhigh_switch = 1 then
  100.                count_hi = count_hi + 1;
  101. {**********************************************************}
  102. {                      Check Conditions                    }
  103. {**********************************************************}
  104.                  t = 0;
  105.               done = 0;
  106.              for i = 0; done = 0; i = i - 1;
  107.                begin
  108.                 if i <= -qc then
  109.                 done = 1;
  110.                 if c[i] >= lo30 and c[i] <= hi30 then
  111.                 t = t + 1;
  112.                else
  113.                 done = 1;
  114.              end;
  115. {**********************************************************}
  116. {                   Calculate Equations                    }
  117. {**********************************************************}
  118.              hirg = hhv(c,t);
  119.              lorg = llv(c,t);
  120.               rng = (1-(lorg/hirg))*100;
  121.              vo50 = mov(v,50,'s');
  122.             vvo50 = (v/vo50)*100;
  123.                v5 = mov(v,5,'s');
  124.            v5vo50 = (v5/vo50)*100;
  125.               v10 = mov(v,10,'s');
  126.           v10vo50 = (v10/vo50)*100;
  127.                oh = 100-((c/hiqc)*100);
  128.               chg = c-c[-1];
  129. {**********************************************************}
  130. {                     Graph Results                        }
  131. {**********************************************************}
  132. if Graph1 = 1 then
  133. begin
  134.   opengraph(2);
  135.   sizegraph(4,2);
  136.   graph(1,' '+format(c[0],'$%5.2f')+' is '
  137.         +format(oh,'%2.1f%')+' off '
  138.         +format(hiqc,'$%5.2f')+' high.   Change= '
  139.         +format(chg,'$%2.2f')
  140.         +'   Base less than '+format(rng,'%2.1f%')
  141.         +' for '+format(t,'%2.f')+' days.');
  142.     if newhigh_switch = 1 then
  143.         goto graphvol;
  144.   drawline(12,0,lorg[-1],0,lorg[-1],-t,-1);
  145.   drawline(12,0,hirg[-1],0,hirg[-1],-t,-1);
  146.   :graphvol
  147.   graph(v,'Today='+format(v[0],'%5.f')
  148.         +'    50MA='+format(vo50[0],'%5.f')
  149.         +'    %Today='+format(vvo50,'%4.f%')
  150.         +'    5MA='+format(v5vo50,'%4.f%')
  151.         +' of 50MA.  10MA='+format(v10vo50,'%4.f%')
  152.         +' of',vo50,'50MA');
  153.   closegraph();
  154. end;
  155. {**********************************************************}
  156. {                     Write Results                        }
  157. {**********************************************************}
  158. if Full_Report = 1 then
  159. begin
  160.   if newhigh_switch = 1 then
  161.        goto write_nobase;
  162.   writeln(fullname,' ',c[0],' ',chg,int(oh),'%',
  163.           hiqc,int(rng),'%',int(t),'  ',int(v[0]),
  164.           int(vvo50),'%');
  165.   gosub standard_2;
  166. {**********************************************************}
  167. {         Don't confuse brains for a bull market           }
  168. {**********************************************************}
  169.   :write_nobase
  170.   writeln(fullname,' ',c[0],' ',chg,int(oh),'%',hiqc,
  171.           '    No Base  ',int(v[0]),int(vvo50),'%');
  172.   gosub standard_2;
  173. end;
  174. {**********************************************************}
  175. {                  Standard 2nd Page Graph                 }
  176. {**********************************************************}
  177.   :standard_2
  178. if Graph2 = 1 then
  179. begin
  180.   opengraph(4,-60,0);
  181.   graph(stoch(5,3),'5-3 Stochastic with lines on 80 and 20');
  182.   drawline(4,0,80,0,80);
  183.   drawline(4,0,20,0,20);
  184.   graph(MACD(),'MACD and Trigger',MACDTRI());
  185.   graph(CCI(10),'10 DAY CCI');
  186.   graph(rsi(14),'14 DAY Relative Strength with lines on 70 and 30');
  187.   drawline(4,0,70,0,70);
  188.   drawline(4,0,30,0,30);
  189.   closegraph();
  190. end;
  191. {**********************************************************}
  192. {                     Calculate Count                      }
  193. {**********************************************************}
  194. :Summary
  195. if last_ticker then
  196. begin
  197.   percent_new_highs = (count_hi/tick_count)*100;
  198.   percent_15 = (count_15/tick_count)*100;
  199.   percent_10 = (count_10/tick_count)*100;
  200.   percent_5 = (count_5/tick_count)*100;
  201.   off_high = tick_count - count_hi - count_15 -
  202.            count_10 - count_5;
  203.   percent_off_high = (off_high/tick_count)*100;
  204. {**********************************************************}
  205. {                     Write Summary                        }
  206. {**********************************************************}
  207.   Writeln();
  208.   Writeln('************** SUMMARY ****************');
  209.   Writeln(int(tick_count),' Total Tickers Processed');
  210.   Writeln('    ',int(count_hi),' ',' New Highs ',
  211.           format(percent_new_highs,'%5.1f%'),' of total');
  212.   Writeln('    ',int(count_5),' ',' <=  5% Off High',
  213.           format(percent_5,'%5.1f%'),' of total');
  214.   Writeln('    ',int(count_10),' ',' <= 10% Off High',
  215.           format(percent_10,'%5.1f%'),' of total');
  216.   Writeln('    ',int(count_15),' ',' <= 15% Off High',
  217.           format(percent_15,'%5.1f%'),' of total');
  218.   Writeln('    ',int(off_high),' ',' >  15% ',
  219.           format(percent_off_high,'%5.1f%'),' of total');
  220. end;
  221.