home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / finance / tas515dm.zip / EXAMPLES.ZIP / MASSINDX.ZIP / MASSIND1.TAS next >
Text File  |  1992-06-03  |  2KB  |  69 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. The article says they chose an arbitrary period of 15 days as an exit point.
  23. }
  24. #MAX_QUOTES 300   {Minimun of 100}
  25. #output_file 'massind1.LST+'
  26. RNGE_DAILY : ARRAY;
  27. SMOOTH_DAILY : ARRAY;
  28. SMOOTH_SMOOTH : ARRAY;
  29. SMOOTH_DIVISOR : ARRAY;
  30. SUM_SMOOTH : ARRAY;
  31. ma1 : ARRAY;
  32. ma2 : ARRAY;
  33. if first_ticker then
  34. begin
  35.  writeln('                               Mass     ExpMA   Fast    Slow');
  36.  write('Sig Ticker  Name               Index    Range    MA      MA     ');
  37.  writeln('Close  Vol    Path');
  38. end;
  39. if quote_count < 50 or c < 10 THEN return;
  40. graphit = 0;             {If you want graphs set to 1 }
  41. RNGE_DAILY = SUB(h,l);
  42. SMOOTH_DAILY = MOV(RNGE_DAILY,25,'E');
  43. SMOOTH_SMOOTH = MOV(SMOOTH_DAILY,25,'E');
  44. SMOOTH_DIVISOR = DIV(SMOOTH_DAILY,SMOOTH_SMOOTH);
  45. SUM_SMOOTH = SUM(SMOOTH_DIVISOR,25);
  46.  ma1 = MOV(c,25,'E');
  47.  ma2 = MOV(ma1,25,'E');
  48. if sum_smooth < 26.5 and (sum_smooth[-1] >= 27 or
  49. sum_smooth[-2] >= 27 or sum_smooth[-3] >= 27 or
  50. sum_smooth[-4] >= 27 or sum_smooth[-5] >= 27 or
  51. sum_smooth[-6] >= 27 or sum_smooth[-7] >= 27) then
  52.   gosub results;
  53. return;
  54. :results
  55. if graphit <> 1 then goto pfile;
  56. OPENGRAPH(2);
  57. GRAPH(SUM_SMOOTH,'Mass Index');
  58. GRAPH(C,'Close',ma1,'Mov Avg Fast',ma2,'Mov Avg Slow');
  59. CLOSEGRAPH();
  60. gosub pfile;
  61. return;
  62. :pfile
  63. if ma1 < ma2 then sig = 'Buy '
  64.  else
  65.  sig = 'Sell';
  66. writeln(sig,' ',ticker,fullname,' ',sum_smooth,smooth_daily,ma1,ma2,c,v,' ',
  67. datapath);
  68. return;
  69.