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

  1. {The MACD, both an oscillator and a trend following device, is relatively
  2. useless when there is no trend and when there are only minor swings around
  3. the trend. People who do backtesting with this indicator end up with medio-
  4. cre results at best. Maybe this why it has become silent about this oldie.
  5. But, if there has been a good trend and a good swing with it in either
  6. direction, the MACD does a decent job to spot the turning-up's and -down's.
  7. Therefore, I filter with a minimum percentage (!) away from the zero-line
  8. and (!!!) with a completed buy or sell signal. This way you make sure to
  9. go after a stock which has risen or fallen substantially and is about to
  10. turn. TAS, unfortunately, does not graph MACD and MACDTRI in %-terms. The
  11. 3 moving averages in the stock chart tell you if the trend is well defined
  12. or in a turning mode. If the trend is well defined i.e. the MA's move as
  13. parallels without intersections, priority should be given to the trend.
  14. This script deals only with the MACD indicating a top. For the other way,
  15. please just replace the <'s, >'s, +'s and -'s and the like. The percentages
  16. away from the zero-line, i.e. the %-difference of the MACD's components,
  17. may be varied from stock to stock and adjusted to market conditions.
  18. Good luck !}
  19.  
  20. #max_quotes 100
  21. #output_file 'macd_sel.lst'
  22. graph_switch = 1;
  23. if first_ticker then
  24. begin
  25. writeln('TICKER   SHORT MA   LONG MA   MACD_$   MACD_%    TRIGGER');
  26. end;
  27. short_ma : array;
  28. short_ma = mov(c,12,'e');
  29. long_ma  : array;
  30. long_ma  = mov(c,25,'e');
  31. macd_abs : array;
  32. macd_abs = macd();
  33. macd_pct : array;
  34. macd_pct = DIV(macd(),short_ma)* 100;
  35. trigger  : array;
  36. trigger  = MACDTRI();
  37. if macd_pct > 2.0 and  macd_pct < 3.0 and trigger > macd_abs then
  38. BEGIN
  39. gosub dograph;
  40. writeln(ticker,short_ma,'   ',long_ma,' ',macd_abs,'',macd_pct,
  41. '   ',trigger,'  ',' ***SELL***');
  42. if macd_pct > 3.0 and trigger > macd_abs then
  43. BEGIN
  44. gosub dograph;
  45. writeln(ticker,short_ma,'   ',long_ma,' ',macd_abs,'',macd_pct,
  46. '   ',trigger,'  ',' ***STRONG SELL***');
  47. END;
  48. return;
  49. :dograph
  50. if graph_switch = 0 then return;
  51. opengraph(2,-100,0);
  52. sizegraph(1,1);
  53. graph(1,mov(c,10,'s'),'10-days-SMA',mov(c,20,'s'),'20-days-SMA',
  54.       mov(c,40,'s'),'40-days-SMA')
  55. graph(macd(),'MACD-$',trigger,'TRIGGER')
  56. {drawline(11,0,2.0,0,2.0);}
  57. {drawline(13,0,3.0,0,3.0);}
  58. closegraph();
  59. return;
  60.  
  61.