home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / finance / tas515dm.zip / EXAMPLES.ZIP / THRUST.TAS < prev    next >
Text File  |  1993-03-11  |  6KB  |  145 lines

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