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

  1. {TICKINDX.TAS         Written 3/31/93 by Tom Rategan
  2.      Script produces price and volume graphs representing the cumulative
  3. price and volume action of all stocks scanned in the ticker list. Good
  4. indicator of the overall market or of any industry sector represented
  5. by your ticker list.
  6.      The price graph was changed 5/1/93 to be unweighted. The price array
  7. for each stock scanned is adjusted so that the first price is 100, and
  8. all the following prices then proceed from the origin of 100. The adjusted
  9. price arrays for each stock are added and at the end, averaged. So the
  10. final price graph will always begin at 100 and proceed from there. Stocks
  11. are "equalized" prior to being averaged in, so they are weighted equally
  12. reguardless of their true share price. The old script simply averaged
  13. all of the stocks prices, so naturally the action of the higher priced
  14. stocks had more effect on the direction of the final graph. This version
  15. also has the advantage that it is easy to figure the rate of change
  16. of the average stock over the course of time which the graph displays,
  17. because the starting value will always be 100.
  18. The legend above the graph tells the number of stocks which were counted
  19. in the survey. In parenthesis is shown the number which were skipped
  20. due to lack of data. The "RG= XX%" compares today's high-to-low range
  21. with the average range over the trailing 50 days. 100% indicates
  22. average volatility, >100% is more volatility, and <100% less volatility.
  23. "C is XX% of H" indicates where the close is relative to the high and
  24. low. The formula is: ((close-low)/(high-low))*100. A value >50% indicates
  25. that stocks closed closer to their highs on average, <50% means they
  26. closed closer to their lows. This may be helpful in forshadowing the next
  27. day's market action.
  28.      The volume graph shows what percentage of its trailing 50MA the
  29. average stock traded that day. So it is effectively an unweighted graph,
  30. as each stock is measured against its own 50MA. The legend also tells
  31. how recent volume has been, averaging four of the trailing 5 day periods
  32. and reporting them as W1, W2, W3, and W4. Advance and decline figures
  33. were added to the volume graph 5/1/93, along with corresponding average
  34. volume percentages for each group. The average price ((h+l+c)/3) is
  35. used to determine whether stocks advanced or declined, so more stocks
  36. will be included in either group than if the close alone were used.
  37.      An Acc-Dis graph was added 5/1/93. The graph is computed from the
  38. final price/volume graphs. The indicator compares all volume on days
  39. when the average price ((h+l+c)/3) was up to all volume on days when
  40. average price was down, over the trailing 40 days. The sum of up and
  41. down volume is averaged, and the down value is subtracted from the up
  42. value. The result will be some value less than or greater than 0,
  43. depending on whether there is selling or buying pressure.
  44.      You can control the number of days which are graphed by changing the
  45. number in the #max_quotes line. The script will graph 50 days fewer than
  46. the number in the #max_quotes line. The number should be some value
  47. greater than 70. *Note- It is important that both the first ticker on
  48. your list and the last ticker have sufficient data (the # in the
  49. #max_quotes line) or else there will be no output. Also if you specify
  50. a minimum price for stocks in line 54, the last ticker must be of an
  51. adequate price so not to get skipped.
  52. }
  53. #max_quotes 305
  54. {if c[0] < X then return;}  {<< Remove the braces and give a value to X if
  55.                             you want to skip stocks below a certain price}
  56. if first_ticker then begin
  57. cuml_hi : array;
  58. cuml_lo : array;
  59. cuml_cl : array;
  60. cuml_vo : array;
  61. minquotes = quote_count + 0;
  62. skips = 0;
  63. act = 0;
  64. dct = 0;
  65. avl = 0;
  66. dvl = 0;
  67. end;
  68. if quote_count < minquotes then skips = skips + 1;
  69. if quote_count < minquotes then return;
  70. count = count + 1;
  71. eqf = 100/c[50];
  72. cuml_hi = add(mulby(h,eqf),cuml_hi);
  73. cuml_lo = add(mulby(l,eqf),cuml_lo);
  74. cuml_cl = add(mulby(c,eqf),cuml_cl);
  75. nv : array;
  76. nv = mulby(div(v,mov(v,50,'s')),100);
  77. cuml_vo = add(nv,cuml_vo);
  78. if (h[0]+l[0]+c[0])/3 > (h[-1]+l[-1]+c[-1])/3 then begin act = act + 1;
  79.                                               avl = avl + nv[0]; end;
  80. if (h[0]+l[0]+c[0])/3 < (h[-1]+l[-1]+c[-1])/3 then begin dct = dct + 1;
  81.                                               dvl = dvl + nv[0]; end;
  82. if last_ticker then goto addup else return;
  83. :addup
  84. cuml_vo = divby(cuml_vo,count);
  85. cuml_hi = divby(cuml_hi,count);
  86. cuml_lo = divby(cuml_lo,count);
  87. cuml_cl = divby(cuml_cl,count);
  88. x=1;
  89. :redefine
  90. x=x-1;
  91. if x = -(quote_count) then goto nextstep;
  92. h[x] = cuml_hi[x];
  93. l[x] = cuml_lo[x];
  94. c[x] = cuml_cl[x];
  95. goto redefine;
  96. :nextstep
  97. chg = c[0] - c[-1];
  98. pchg = (chg/c[-1])*100;
  99. hiprc : array;
  100. hiprc = hhv(c,quote_count-50);
  101. oh = (1-(c[0]/hiprc[0]))*100;
  102. trg : array;
  103. trg = tr();
  104. ar = sum(trg,50)/50;
  105. rgt = (trg[0]/ar)*100;
  106. ct = ((c[0]-l[0])/(h[0]-l[0]))*100;
  107. ma50 : array;
  108. ma50 = mov(c,50,'s');
  109. v1= (cuml_vo[-1]+cuml_vo[-2]+cuml_vo[-3]+cuml_vo[-4]+cuml_vo[-5])/5;
  110. v2= (cuml_vo[-6]+cuml_vo[-7]+cuml_vo[-8]+cuml_vo[-9]+cuml_vo[-10])/5;
  111. v3= (cuml_vo[-11]+cuml_vo[-12]+cuml_vo[-13]+cuml_vo[-14]+cuml_vo[-15])/5;
  112. v4= (cuml_vo[-16]+cuml_vo[-17]+cuml_vo[-18]+cuml_vo[-19]+cuml_vo[-20])/5;
  113. acp = (act/count)*100;
  114. dcp = (dct/count)*100;
  115. acv = (avl/act);
  116. dcv = (dvl/dct);
  117. avp : array;
  118. avp = avgprc();
  119. up : array;
  120. dn : array;
  121. adl : array;
  122. x = 1;
  123. :make_uds
  124. x=x-1;
  125. if x <= -(quote_count-50) then cuml_vo[x] = 100;
  126. if x = -(quote_count-1) then goto make_line;
  127. if avp[x] > avp[x-1] then up[x] := cuml_vo[x] else up[x] := 0;
  128. if avp[x] < avp[x-1] then dn[x] := cuml_vo[x] else dn[x] := 0;
  129. goto make_uds;
  130. :make_line
  131. adl = sub(mov(up,40,'s'),mov(dn,40,'s'));
  132. ud_chg= adl[0] - adl[-1];
  133. da= -40;
  134. np = 0;
  135. :check_perc_zero
  136. da = da + 1;
  137. if da = 1 then goto perc_zero;
  138. if adl[da]>=0 then np = np + 1;
  139. goto check_perc_zero;
  140. :perc_zero
  141. p_one = (np/40)*100;
  142. x_ago = 1;
  143. :check_cross
  144. x_ago = x_ago - 1;
  145. if x_ago = -(quote_count-41) then goto ud50;
  146. if adl[x_ago] >0 and adl[x_ago-1] <0 then goto ud50;
  147. if adl[x_ago]<0 and adl[x_ago-1] >0 then goto ud50 else goto check_cross;
  148. :ud50
  149. if x_ago <> 0 then x_ago = -x_ago;
  150. av = 0;
  151. dv = 0;
  152. d = 0;
  153. :loop
  154. gosub count;
  155. if d = -51 then goto figure;
  156. if c[d] < c[d+1] then av = av + cuml_vo[d+1];
  157. if c[d] > c[d+1] then dv = dv + cuml_vo[d+1];
  158. goto loop;
  159. :count
  160. d = d - 1;
  161. return;
  162. :figure
  163. ud = av/dv;
  164. opengraph(3,-(quote_count-49),0);
  165. sizegraph(3,1,1);
  166. graph(1,''+format(count,'%3.f')+' ('+format(skips,'%1.f')+
  167. ')   '+format(c[0],'%2.2f')+' is '+format(oh,'%1.1f%')+
  168. ' off '+format(hiprc[0],'%2.2f')+' high.  Chg= '+format(chg,'%1.2f')
  169. +', '+format(pchg,'%1.2f%')+'  Rg='+format(rgt,'%3.f%')
  170. +'  C'+format(ct,'%3.f%')+' of H.',ma50,'50MA');
  171. graph(cuml_vo,'AV= '+format(cuml_vo[0],'%2.f%')
  172. +' of 50MA.  '+format(acp,'%2.f%')+' Adv, V= '+format(acv,'%2.f%')+
  173. '  '+format(dcp,'%2.f%')+' Dec, V= '+format(dcv,'%2.f%')+
  174. '    W1= '+format(v1,'%2.f%')+'  W2= '+format(v2,'%2.f%')+
  175. '  W3= '+format(v3,'%2.f%')+'  W4= '+format(v4,'%2.f%'));
  176. drawline(7,0,100,0,100);
  177. graph(adl,'40 A-D= '+format(adl[0],'%1.1f')+'   Chg= '
  178. +format(ud_chg,'%1.1f')+'   Above Zero (40 Days)= '+format(p_one,'%2.f%')
  179. +'   Last Cross '+format(x_ago,'%1.f')+' Days Ago.   50 U/D= '
  180. +format(ud,'%1.2f'));
  181. drawline(7,0,0,0,0);
  182. closegraph();
  183.