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

  1. {
  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. #max_quotes 255
  28. #output_file 'BASE-NH.LST'
  29. if first_ticker then begin
  30. writeln(
  31. '      ********* New highs and possible near base breakouts. *********
  32. ');
  33. writeln(
  34. '                                         All Time |--Base--|');
  35. writeln(
  36. '    Name           Close    Change   %OH   High   %Rng  Days   Vol   %V'
  37. );
  38. writeln(
  39. '    ----           -----    ------   ---   ----   ----  ----   ---   --'
  40. );
  41. end;
  42. {**********************************************************}
  43. {                     Count Tickers                        }
  44. {**********************************************************}
  45.                 tick_count = tick_count + 1;
  46. {**********************************************************}
  47. {                     Declare Arrays                       }
  48. {**********************************************************}
  49.                      lorg : array;
  50.                      hirg : array;
  51.                      vo50 : array;
  52. {**********************************************************}
  53. {                   Do  Some  Filtering                    }
  54. {**********************************************************}
  55.              if quote_count < 65 then gosub Summary;
  56.              qc = (quote_count-2);
  57.              hiqc = hhv(c,qc);
  58.              if c < (hiqc * .95) then gosub Summary;
  59.              hipcnt = hiqc * .85;
  60.              if c >= hiqc then
  61.                 newhigh_switch = 1;
  62.                else
  63.                 newhigh_switch = 0;
  64. {**********************************************************}
  65. {                    Filter and Count                      }
  66. {**********************************************************}
  67.              hi30 = hhv(c,30);
  68.              lo30 = llv(c,30);
  69.              r30 = (1-(lo30/hi30))*100;
  70.              if r30 > 15 then
  71.                gosub Summary
  72.               else
  73.                count_15 = count_15 + 1;
  74.              if r30 < 10  then
  75.                count_10 = count_10 + 1;
  76.              if r30 < 5 then
  77.                count_5 = count_5 + 1;
  78.              if newhigh_switch = 1 then
  79.                count_hi = count_hi + 1;
  80. {**********************************************************}
  81. {                      Check Conditions                    }
  82. {**********************************************************}
  83.         t = 0;
  84.         done = 0;
  85.         for i = 0; done = 0; i = i - 1;
  86.         begin
  87.         if i <= -qc then
  88.              done = 1;
  89.         if c[i] >= lo30 and c[i] <= hi30 then
  90.              t = t + 1;
  91.         else
  92.              done = 1;
  93.         end;
  94. {**********************************************************}
  95. {                   Calculate Equations                    }
  96. {**********************************************************}
  97.         hirg = hhv(c,t);
  98.         lorg = llv(c,t);
  99.          rng = (1-(lorg/hirg))*100;
  100.         vo50 = mov(v,50,'s');
  101.        vvo50 = (v/vo50)*100;
  102.           v5 = mov(v,5,'s');
  103.       v5vo50 = (v5/vo50)*100;
  104.          v10 = mov(v,10,'s');
  105.      v10vo50 = (v10/vo50)*100;
  106.           oh = 100-((c/hiqc)*100);
  107.          chg = c-c[-1];
  108. {**********************************************************}
  109. {                     Graph Results                        }
  110. {**********************************************************}
  111.   opengraph(2);
  112.   sizegraph(4,2);
  113.   graph(1,' '+format(c[0],'$%5.2f')+' is '
  114.         +format(oh,'%2.1f%')+' off '
  115.         +format(hiqc,'$%5.2f')+' high.   Change= '
  116.         +format(chg,'$%2.2f')
  117.         +'   Base less than '+format(rng,'%2.1f%')
  118.         +' for '+format(t,'%2.f')+' days.');
  119.     if newhigh_switch = 1 then
  120.         goto graphvol;
  121.   drawline(12,0,lorg[-1],0,lorg[-1],-t,-1);
  122.   drawline(12,0,hirg[-1],0,hirg[-1],-t,-1);
  123.   :graphvol
  124.   graph(v,'Today='+format(v[0],'%5.f')
  125.         +'    50MA='+format(vo50[0],'%5.f')
  126.         +'    %Today='+format(vvo50,'%4.f%')
  127.         +'    5MA='+format(v5vo50,'%4.f%')
  128.         +' of 50MA.  10MA='+format(v10vo50,'%4.f%')
  129.         +' of',vo50,'50MA');
  130.   closegraph();
  131. {**********************************************************}
  132. {                     Write Results                        }
  133. {**********************************************************}
  134.   if newhigh_switch = 1 then
  135.        goto write_nobase;
  136.   writeln(fullname,' ',c[0],' ',chg,int(oh),'%',
  137.           hiqc,int(rng),'%',int(t),'  ',int(v[0]),
  138.           int(vvo50),'%');
  139.   gosub standard_2;
  140. {**********************************************************}
  141. {         Don't confuse brains for a bull market           }
  142. {**********************************************************}
  143.   :write_nobase
  144.   writeln(fullname,' ',c[0],' ',chg,int(oh),'%',hiqc,
  145.           '    No Base  ',int(v[0]),int(vvo50),'%');
  146.   gosub standard_2;
  147. {**********************************************************}
  148. {                  Standard 2nd Page Graph                 }
  149. {**********************************************************}
  150.   :standard_2
  151.   opengraph(4,-60,0);
  152.   graph(stoch(5,3),'5-3 Stochastic with lines on 80 and 20');
  153.   drawline(4,0,80,0,80);
  154.   drawline(4,0,20,0,20);
  155.   graph(MACD(),'MACD and Trigger',MACDTRI());
  156.   graph(CCI(10),'10 DAY CCI');
  157.   graph(rsi(14),'14 DAY Relative Strength with lines on 70 and 30');
  158.   drawline(4,0,70,0,70);
  159. drawline(4,0,30,0,30);
  160. closegraph();
  161. :Summary
  162. {**********************************************************}
  163. {                     Calculate Count                      }
  164. {**********************************************************}
  165. if last_ticker then
  166. begin
  167. percent_new_highs = (count_hi/tick_count)*100;
  168. percent_15 = (count_15/tick_count)*100;
  169. percent_10 = (count_10/tick_count)*100;
  170. percent_5 = (count_5/tick_count)*100;
  171. off_high = tick_count - count_hi - count_15 -
  172.            count_10 - count_5;
  173. percent_off_high = (off_high/tick_count)*100;
  174. {**********************************************************}
  175. {                     Write Summary                        }
  176. {**********************************************************}
  177. Writeln();
  178. Writeln('************** SUMMARY ****************');
  179. Writeln(int(tick_count),' Total Tickers Processed');
  180. Writeln('    ',int(count_hi),' ',' New Highs ',
  181.         format(percent_new_highs,'%4.1f%'),' of total');
  182. Writeln('    ',int(count_5),' ',' <=  5% Off High',
  183.         format(percent_5,'%4.1f%'),' of total');
  184. Writeln('    ',int(count_10),' ',' <= 10% Off High',
  185.         format(percent_10,'%4.1f%'),' of total');
  186. Writeln('    ',int(count_15),' ',' <= 15% Off High',
  187.         format(percent_15,'%4.1f%'),' of total');
  188. Writeln('    ',int(off_high),' ',' >  15% ',
  189.         format(percent_off_high,'%4.1f%'),' of total');
  190. end;
  191.