home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / finance / tas515dm.zip / EXAMPLES.ZIP / MAC.TAS < prev    next >
Text File  |  1991-08-04  |  2KB  |  48 lines

  1. #MAX_QUOTES 1000
  2. { MAC.TAS
  3.    This script will calculate the McClellan Oscillator
  4.    and the McClellan Summation indicators.
  5.    -----------------------------------------------------
  6.    To run this, you should have a ticker file containing
  7.    only NYAD and NYDE (or whatever symbols you use for
  8.    NYSE Advancing and NYSE Declining issues
  9.    -----------------------------------------------------
  10.    Calculate a McClellan Oscillator as follows
  11.    ADdiff = NYAD - NYDE;
  12.    MacOsc = MOV(ADdiff,19,'E')-MOV(ADdiff,39,'E')
  13.    Calculate a McClellan Summation as follows
  14.    MacSum = cum(MacOsc) + MacSumBase
  15.         where 'MacSumBase' is a starting value for the
  16.               McClellan Summation so that it is
  17.               "in sync" with someone else's value
  18. }
  19. #index 'sp-500'
  20. #output_file mac.lst
  21. NYADname = 'NYAD';      { Change to your NYSE Adv Issues ticker}
  22. NYDEname = 'NYDE';      { Change to your NYSE Dec Issues ticker}
  23. NYAD : ARRAY;           { advancing issues}
  24. NYDE : ARRAY;           { declining issues}
  25. ADdiff : ARRAY;         { advancing - declining}
  26. MacOsc : ARRAY;         { McClellan Oscillator goes here}
  27. MacSum : ARRAY;         { McClellan Summation goes here}
  28. MacSumBase = 522.15;         { Set this to whatever starting value
  29.                               you want to MacSum to start at}
  30. MacBaseArray : ARRAY;   { array of Base value}
  31. if ticker = NYADname then   
  32.    NYAD = C;                    { #issues in the CLOSE field}
  33. if ticker = NYDEname then
  34.    NYDE = C;                    { #issues in the CLOSE field}
  35. if last_ticker = 0 then return;  
  36. ADdiff = SUB(NYAD,NYDE);   { Adv - Dec}
  37. MacOsc = SUB(MOV(ADdiff,19,'E'),MOV(ADdiff,39,'E')); {19ema-39ema}
  38. SET(MacBaseArray,MacSumBase);   { set array to constant value}
  39. MacSum = CUM(MacOsc);           { compute cumulative value}
  40. MacSum = ADD(MacSum,MacBaseArray);      { add the base offset for macsum}
  41. OPENGRAPH(3);  { Start 3 graphs}
  42. GRAPH(INDEX,'SP-500 Index');
  43. GRAPH(MacOsc,'McClellan Oscillator');
  44. GRAPH(MacSum,'McClellan Summation');
  45. CLOSEGRAPH();
  46. WRITELN('McClellan Oscillator for ',DATE,' is ',MacOsc);
  47. WRITELN('McClellan Summation  for ',DATE,' is ',MacSum);
  48.