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

  1. {cltren ver 1.0}
  2. {This script REQUIRES THE GRAPHICS FUNCTION
  3. }
  4. {A simple script to look at the dynamics of stocks closing above
  5.  or below there daily average (h+l)/2. It shows a slightly different
  6.  picture than a staight advance decline line, if you run it against a
  7.  ticker file containing only dow jone ind. stocks it looks surprising
  8.  like the sp-500.
  9. }
  10. {Graphs :
  11.          1. Stocks above their daily average.
  12.          2. Stocks below their daily average.
  13.          3. A ratio of below/above stocks
  14.          4. A cumulative total of stocks above and below.
  15. }
  16. {Written by : Steve Hedlund 818-368-2897
  17. }
  18. {=====================================================================}
  19. {SET UP STARTING VARIABLES}
  20. {=====================================================================}
  21. #max_quotes 50
  22. #index spx
  23. ma :=5;  {periods in moving averages}
  24. qs :=50; {number of periods}
  25. {=====================================================================}
  26. {SET UP ARRAYS}
  27. {=====================================================================}
  28. if first_ticker then begin
  29. x : array;
  30. x1 : array;
  31. x2 : array;
  32. x3 : array;
  33. X4 : ARRAY;
  34. X5 : ARRAY;
  35. end;
  36. {=====================================================================}
  37. {CHECKS}
  38. {=====================================================================}
  39. if quote_count<qs then return;
  40. {=====================================================================}
  41. {COMPUTATIONS}
  42. {=====================================================================}
  43. for i=1;i<=qs;i=i+1;
  44. if c[i] > (h[i]+l[i])/2 then x[i] := x[i]+1;else {stocks above average}
  45. if c[i] < (h[i]+l[i])/2 then x1[i] := x1[i]+1;   {stocks below average}
  46. {=====================================================================}
  47. {FINAL COMPUTATIONS AND GRAPHS}
  48. {=====================================================================}
  49. if last_ticker then begin
  50. x3 :=div(x1,x);                                 {compute ratio b/a }
  51. X4 :=SUB(X,x1);                                 {calculate cumm total 1}
  52. X5 :=CUM(X4);                                   {caluclate cumm total 2}
  53. opengraph(5);
  54. graph(x,MOV(x,ma,'S'),'Stocks Closing Above Daily Average');
  55. graph(x1,MOV(x1,ma,'S'),'Stocks Closing Below Daily Average');
  56. graph(x3,MOV(X3,ma,'S'),'Ratio of Stocks Below / Stocks Above');
  57. GRAPH(X5,mov(x5,ma,'s'),'Cumulative Total');
  58. graph(index,'Standard and Poors 500');
  59. closegraph();
  60. end;
  61.