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

  1. { MARKET.TAS
  2.    This script generates a market 'snapshot'. It will
  3.    calculate
  4.         
  5.    -the McClellan Oscillator and the McClellan Summation 
  6.       indicators.
  7.    -the ARMS Short Term Trading Index.
  8.    -the Elphick's Volume Oscillator 
  9.  
  10.    Calculate a McClellan Oscillator as follows
  11.         ADdiff = NYAD - NYDE;
  12.         MacOsc = MOV(ADdiff,19,'E')-MOV(ADdiff,39,'E')
  13.    Calculate EVO as 
  14.         CVI = cumulative sum of (up vol-down vol)/total vol
  15.         EVO = (3 day EMA of CVI - 10 day EMA of CVI) * 100
  16.    Calculate Arms' Short Term Trading Index as 
  17.         TRIN =  (ADV ISSUES/DEC ISSUES)
  18.                 ------------------------
  19.                 (ADV VOL/DEC VOL)
  20.    Calculate the 10 Day Open TRIN as
  21.       10dayTRIN = SUM(ADV ISSUES,10)/SUM(DEC ISSUES,10)
  22.                   -------------------------------------
  23.                   SUM(ADV VOL,10)/SUM(DEC VOL,10)
  24.    -----------------------------------------------------
  25.    To run this, you should have a ticker file containing
  26.    one of the following tickers and modify the variables 
  27.    named below to be the names of the tickers containing
  28.    your advancing/declining issues, NYSE up/dn vol and
  29.    NYSE total volume.
  30.  
  31.    It is important to note that ALL of the ticker files
  32.    must have the _SAME_ number of quotes, or you should
  33.    set #MAX_QUOTES to the _minimum_ number of quotes in
  34.    any of the ticker files used for indices.
  35.  
  36.    NYADname -       Advancing 
  37.    NYDEname -       and NYSE Declining issues
  38.    SPNUname -       NYSE Up Volume
  39.    SPNDname -       NYSE Down Volume
  40.    NYSEname -       Composite
  41.  
  42.    -----------------------------------------------------
  43. }
  44. MacSumBase = 310.005;  { Set this to whatever starting value
  45.                           you want to MacSum to start at}
  46. CVIBase = 0;        { and to adjust for the keeper of the EVO}
  47. #index 'sp-500'
  48. #output_file 'market.lst'
  49. {
  50.         NOTE----------------------------------------------
  51.            Change the 5 symbol names in quotes below to 
  52.            whatever symbols you use for the tickers shown
  53.         NOTE----------------------------------------------
  54. }
  55. NYADname = 'NYAD';      { Change to your NYSE Adv Issues ticker}
  56. NYDEname = 'NYDE';      { Change to your NYSE Dec Issues ticker}
  57. NYUPname = 'SPNU';      { Change to your NYSE UP Vol ticker}
  58. NYDNname = 'SPND';      { Change to your NYSE DN Vol ticker}
  59. NVOLname = 'NYSE';      { Change to your NYSE Total Volume}
  60. GRAPH_IT = 0;           { Set to 1 to see graphs}
  61. NYAD : ARRAY;           { advancing issues}
  62. NYDE : ARRAY;           { declining issues}
  63. NYUP : ARRAY;           { Up Vol}
  64. NYDN : ARRAY;           { Dn Vol}
  65. NVOL : ARRAY;           { Total Vol}
  66. NYSE : ARRAY;           { NYSE Comp}
  67. VLdiff : ARRAY;         { Up - Dn}
  68. CVI    : ARRAY;         { Cum Vol Index}
  69. EVO    : ARRAY;         { EVO goes here}
  70. ADdiff : ARRAY;         { advancing - declining}
  71. MacOsc : ARRAY;         { McClellan Oscillator goes here}
  72. MacSum : ARRAY;         { McClellan Summation goes here}
  73. MacBaseArray : ARRAY;   { array of Base value}
  74. CVIBaseArray : ARRAY;   { Mike Elphick's values}
  75. TRIN : ARRAY;
  76. TRINdays = 10;          { 10 day open TRIN}
  77. TRIN_AI : ARRAY;        { 10 day advancing issues}
  78. TRIN_DI : ARRAY;        { 10 day declining issues}
  79. TRIN_AV : ARRAY;        { 10 day advancing vol}
  80. TRIN_DV : ARRAY;        { 10 day declining vol}
  81. TRINma : ARRAY; { TRIN moving average}
  82.  
  83. NYAD = LOAD(NYADNAME,'C');
  84. NYDE = LOAD(NYDENAME,'C');
  85. NYUP = LOAD(NYUPNAME,'C');
  86. NYDN = LOAD(NYDNNAME,'C');
  87. NVOL = LOAD(NVOLname,'V');
  88. NYSE = LOAD(NVOLname,'C');
  89. {----------COMPUTATION HERE --------------}
  90. if last_ticker = 0 then return;  
  91. {----- McClellan calculation-----}
  92. ADdiff = SUB(NYAD,NYDE);   { Adv - Dec}
  93. MacOsc = SUB(MOV(ADdiff,19,'E'),MOV(ADdiff,39,'E')); {19ema-39ema}
  94. SET(MacBaseArray,MacSumBase);   { set array to constant value}
  95. MacSum = CUM(MacOsc);           { compute cumulative value}
  96. MacSum = ADD(MacSum,MacBaseArray);      { add the base offset for macsum}
  97. {----- EVO calculation-----}
  98. VLdiff = DIV(SUB(NYUP,NYDN),NVOL);   { (UP - DN)/TOTAL}
  99. CVI = CUM(VLdiff);
  100. SET(CVIBaseArray,CVIBase);   { set array to constant value}
  101. CVI = ADD(CVI,CVIBaseArray);
  102. EVO = SUB(MOV(CVI,3,'E'),MOV(CVI,10,'E')); {10ema-3ema}
  103. EVO = MULBY(EVO,100);   { EVO * 100}
  104. {-----TRIN calculation-----}
  105. TRIN = DIV(NYAD,NYDE);
  106. TRIN = DIV(TRIN,DIV(NYUP,NYDN));
  107. TRIN_AI = SUM(NYAD,TRINdays);
  108. TRIN_DI = SUM(NYDE,TRINdays);
  109. TRIN_AV = SUM(NYUP,TRINdays);
  110. TRIN_DV = SUM(NYDN,TRINdays);
  111. TRINma = DIV(TRIN_AI,TRIN_DI);
  112. TRINma = DIV(TRINma,DIV(TRIN_AV,TRIN_DV));
  113. { now that all the values are calculated,
  114. write them out}
  115. WRITELN(
  116. '                   TAS Market Summary for ',DATE);
  117. WRITELN();
  118. WRITELN(
  119. '                                   Today  Yesterday',
  120. '     Change');
  121.  
  122. WRITELN('McClellan Oscillator            ',MacOsc,'   ',MacOsc[-1],
  123.     '   ',MacOsc-MacOsc[-1]);
  124. WRITELN('McClellan Summation             ',MacSum,'   ',MacSum[-1],
  125.     '   ',MacSum-MacSum[-1]);
  126. WRITELN('Elphicks Volume Oscillator(EVO) ',EVO,   '   ',EVO[-1],
  127.     '   ',EVO-EVO[-1]);
  128. WRITELN('Cumulative Volume Index(CVI)    ',CVI,    '   ',CVI[-1],
  129.     '   ',CVI-CVI[-1]);
  130. WRITELN('Arms Short Term Index (TRIN)    ',TRIN,'   ',TRIN[-1],
  131.     '   ',TRIN-TRIN[-1]);
  132. WRITELN('Open-10 TRIN                    ',TRINma,'   ',TRINma[-1],
  133.     '   ',TRINma-TRINma[-1]);
  134. if graph_it=0 then return;
  135. OPENGRAPH(3);  { Start 3 graphs}
  136. GRAPH(INDEX,'SP-500 Index');
  137. GRAPH(MacOsc,'McClellan Oscillator');
  138. GRAPH(MacSum,'McClellan Summation');
  139. CLOSEGRAPH();
  140. {At this point, the EVO and CVI are computed and held in arrays
  141.  EVO and CVI. Let's graph them under NYSE Composite}
  142. OPENGRAPH(3);  { Start 3 graphs}
  143. GRAPH(NYSE,'NYSE Composite');
  144. GRAPH(CVI,'Cumulative Volume Index');
  145. GRAPH(EVO,'Elphicks Volume Oscillator');
  146. CLOSEGRAPH();
  147. OPENGRAPH(2);
  148. GRAPH(DJ30,'DOW 30');
  149. GRAPH(TRIN,'ARMS INDEX',TRINma,'ARMS 10 DAY TRIN');
  150. CLOSEGRAPH();
  151.