home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / finance / tas515dm.zip / EXAMPLES.ZIP / MASSINDX.TAS < prev    next >
Text File  |  1992-05-22  |  2KB  |  68 lines

  1. { Mass Index.TAS
  2.   Compute the Mass Index Stocks and Commodities June 1992.
  3.   Article written by Donald Dorsey.
  4.   Program written by Sam Kerr (Prodigy-SXBX09A)
  5.                                        Rn
  6.   Mass Index = Summation n= 1 to 25   ----
  7.                                        Ln
  8.  where:
  9.   Rn = 0.8(Rn-1) + 0.2(Range)
  10.   Ln = 0.8(Ln-1) + 0.2(Rn)
  11.   Range = Todays high - low
  12.   Rn - 1 = Yesterday's Rn
  13.   Ln - 1 = Yesterday's Ln
  14.  
  15. A signal is indicated when the mass index goes over 27 then comes down
  16. through 26.5.  The trade is placed against the direction of the two
  17. moving averages.  If fast moving average(ma1) is greater than the slow
  18. moving average(ma2) then this indicates a reversal bulge and an impending
  19. direction change and would indicate a potential short.  Buying would
  20. be indicated when the mass index goes above 27 then breaks back down through
  21. 26.5 and m1 is less than m2.
  22. }
  23. #MAX_QUOTES 300   {Minimun of 100}
  24. #output_file 'massindx.LST'
  25. RNGE_DAILY : ARRAY;
  26. SMOOTH_DAILY : ARRAY;
  27. SMOOTH_SMOOTH : ARRAY;
  28. SMOOTH_DIVISOR : ARRAY;
  29. SUM_SMOOTH : ARRAY;
  30. ma1 : ARRAY;
  31. ma2 : ARRAY;
  32. if first_ticker then
  33. begin
  34.  writeln('                               Mass     ExpMA   Fast    Slow');
  35.  write('Sig Ticker  Name               Index    Range    MA      MA     ');
  36.  writeln('Close  Vol    Path');
  37. end;
  38. if quote_count < 50 or c < 10 THEN return;
  39. graphit = 1;             {If you want graphs set to 1 }
  40. RNGE_DAILY = SUB(h,l);
  41. SMOOTH_DAILY = MOV(RNGE_DAILY,25,'E');
  42. SMOOTH_SMOOTH = MOV(SMOOTH_DAILY,25,'E');
  43. SMOOTH_DIVISOR = DIV(SMOOTH_DAILY,SMOOTH_SMOOTH);
  44. SUM_SMOOTH = SUM(SMOOTH_DIVISOR,25);
  45.  ma1 = MOV(c,25,'E');
  46.  ma2 = MOV(ma1,25,'E');
  47. if sum_smooth < 26.5 and (sum_smooth[-1] >= 27 or
  48. sum_smooth[-2] >= 27 or sum_smooth[-3] >= 27 or
  49. sum_smooth[-4] >= 27 or sum_smooth[-5] >= 27 or
  50. sum_smooth[-6] >= 27 or sum_smooth[-7] >= 27) and ma1 < ma2 then
  51.   gosub results;
  52. return;
  53. :results
  54. if graphit <> 1 then goto pfile;
  55. OPENGRAPH(2);
  56. GRAPH(SUM_SMOOTH,'Mass Index');
  57. GRAPH(C,'Close',ma1,'Mov Avg Fast',ma2,'Mov Avg Slow');
  58. CLOSEGRAPH();
  59. gosub pfile;
  60. return;
  61. :pfile
  62. if ma1 < ma2 then sig = 'Buy '
  63.  else
  64.  sig = 'Sell';
  65. writeln(sig,ticker,fullname,' ',sum_smooth,smooth_daily,ma1,ma2,c,v,' ',
  66. datapath);
  67. return;
  68.