home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / finance / tas515dm.zip / EXAMPLES.ZIP / BASE-HIA.TAS < prev    next >
Text File  |  1992-03-19  |  6KB  |  148 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.  
  23.      Modifications made to include a for loop to find the
  24.      range and a second page of graphs.
  25. Modified 3/18/92 Jerry Green}
  26. #max_quotes 255
  27. #output_file 'BASE-NH.LST'
  28. if first_ticker then begin
  29. writeln(
  30. '      ********* New highs and possible near base breakouts. *********
  31. ');
  32. writeln(
  33. '                                         All Time |--Base--|');
  34. writeln(
  35. '    Name           Close    Change   %OH   High   %Rng  Days   Vol   %V'
  36. );
  37. writeln(
  38. '    ----           -----    ------   ---   ----   ----  ----   ---   --'
  39. );
  40. end;
  41. {**********************************************************}
  42. {                     Declare Arrays                       }
  43. {**********************************************************}
  44.             hi30 : array;
  45.             lo30 : array;
  46.             hi40 : array;
  47.             lo40 : array;
  48.             hi60 : array;
  49.             lo60 : array;
  50.             hirg : array;
  51.             lorg : array;
  52.             vo50 : array;
  53. {**********************************************************}
  54. {                   Do  Some  Filtering                    }
  55. {**********************************************************}
  56.   qc = (quote_count-2);
  57.   hiqc = hhv(c,qc);
  58.   if quote_count < 65 then return;
  59.   if c < (hiqc*.95) then return;
  60.   if c >= hiqc then
  61.      newhigh_switch = 1;
  62.     else
  63.      newhigh_switch = 0;
  64.   hi30 = hhv(c,30);
  65.   lo30 = llv(c,30);
  66.   r30 = (1-(lo30/hi30))*100;
  67.   if r30 > 15 then return;
  68. {**********************************************************}
  69. {                      Check Conditions                    }
  70. {**********************************************************}
  71.   t = 0;
  72.   done = 0;
  73.   for i = 0; done = 0; i = i - 1;
  74.   begin
  75.   if i <= -qc then
  76.        done = 1;
  77.   if c[i] >= (hiqc*.85) then
  78.   begin
  79.        t = t + 1;
  80.   end;
  81.        else
  82.        done = 1;
  83.   end;
  84. {**********************************************************}
  85. {                   Calculate Equations                    }
  86. {**********************************************************}
  87.          rng = (1-(llv(c,t)/hhv(c,t)))*100;
  88.         hirg = hhv(c,t);
  89.         lorg = llv(c,t);
  90.         vo50 = mov(v,50,'s');
  91.        vvo50 = ((v[0]/vo50[0])*100);
  92.           v5 = mov(v,5,'s');
  93.       v5vo50 = ((v5/vo50[0])*100);
  94.          v10 = mov(v,10,'s');
  95.      v10vo50 = ((v10/vo50[0])*100);
  96.           oh = 100-((c/hiqc)*100);
  97.          chg = c[0]-c[-1];
  98. {**********************************************************}
  99. {                     Graph Results                        }
  100. {**********************************************************}
  101.   opengraph(2);
  102.   sizegraph(4,2);
  103.   graph(1,' '+format(c[0],'$%5.2f')+' is '
  104.         +format(oh,'%2.1f%')+' off '
  105.         +format(hiqc,'$%5.2f')+' high.   Change= '
  106.         +format(chg,'$%2.2f')
  107.         +'   Base less than '+format(rng,'%2.1f%')
  108.         +' for '+format(t,'%2.f')+' days.');
  109.     if newhigh_switch = 1 then
  110.         goto graphvol;
  111.   drawline(12,0,lorg[-1],0,lorg[-1],-t,-1);
  112.   drawline(12,0,hirg[-1],0,hirg[-1],-t,-1);
  113.   :graphvol
  114.   graph(v,'Today='+format(v[0],'%5.f')
  115.         +'    50MA='+format(vo50[0],'%5.f')
  116.         +'    %Today='+format(vvo50,'%4.f%')
  117.         +'    5MA='+format(v5vo50,'%4.f%')
  118.         +' of 50MA.  10MA='+format(v10vo50,'%4.f%')
  119.         +' of',vo50,'50MA');
  120.   closegraph();
  121. {**********************************************************}
  122. {                     Write Results                        }
  123. {**********************************************************}
  124.   if newhigh_switch = 1 then
  125.        goto write_nobase;
  126.   writeln(fullname,' ',c[0],' ',chg,int(oh),'%',
  127.           hiqc,int(rng),'%',int(t),'  ',int(v[0]),
  128.           int(vvo50),'%');
  129.   gosub standard_2;
  130.   :write_nobase
  131.   writeln(fullname,' ',c[0],' ',chg,int(oh),'%',hiqc,
  132.           '    No Base  ',int(v[0]),int(vvo50),'%');
  133.   gosub standard_2;
  134. {**********************************************************}
  135. {                  Standard 2nd Page Graph                 }
  136. {**********************************************************}
  137.   :standard_2
  138.   opengraph(4,-60,0);
  139.   graph(stoch(5,3),'5-3 Stochastic with lines on 80 and 20');
  140.   drawline(4,0,80,0,80);
  141.   drawline(4,0,20,0,20);
  142.   graph(MACD(),'MACD and Trigger',MACDTRI());
  143.   graph(CCI(10),'10 DAY CCI');
  144.   graph(rsi(14),'14 DAY Relative Strength with lines on 70 and 30');
  145.   drawline(4,0,70,0,70);
  146. drawline(4,0,30,0,30);
  147. closegraph();
  148.