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

  1. { CYCLESR.TAS
  2.             -----  With respect to Author Merrill.   -----
  3.       This is a script that will look at the last five peaks of a
  4.       filtered wave of a stock and average those peaks to find the
  5.       common cycle of peaks.  It then finds the quarter cycle and
  6.       uses that number to determine a stochastic.
  7.       This same technique is used to find the cycles for troughs.
  8.       The values of the peak and trough are usually close, but there is
  9.       enough difference to change the buy and sell points.
  10.       written by Jerry Green, Sept. 91, TAS404 version.}
  11. {
  12.           Revised to a dynamic method Nov. 7, 91.  TAS407.
  13. }
  14. #max_quotes 260
  15. zig_prcnt : array;
  16. {   Find a dynamic average of the closing prices to use as a
  17.    percent for the filtered wave .                             }
  18. zig_prcnt = cum(mulby(div(sub(hhv(c,5),llv(c,5)),llv(c,5)),100));
  19. prcnt = zig_prcnt/(quote_count - 6);
  20. ziggy : array;                   {define an array as ziggy}
  21. ziggy = ZIG(c,prcnt,'%');        {filtered wave           }
  22. {   *********************************************************   }
  23. {                   Start SHORT TERM Analysis                   }
  24. {   *********************************************************   }
  25. {   *********************************************************
  26.         Find the count of the wave peaks.
  27.            5          4
  28.           /\        /\           3         2         1
  29.         /    \    /    \        /\        /\        /\
  30.       /        \/        \    /    \    /    \    /    \
  31.     /                      \/        \/        \/
  32.    **********************************************************   }
  33. peaks_5 = (0-peak(ziggy,5))/5;      {find the peak 5 waves ago}
  34. peaks_4 = (0-peak(ziggy,4))/4;      {the 0- is to convert to a +number}
  35. peaks_3 = (0-peak(ziggy,3))/3;
  36. peaks_2 = (0-peak(ziggy,2))/2;
  37. peaks_1 = (0-peak(ziggy,1));
  38. {   **********************************************************
  39.         Find the count of the wave troughs.
  40.           /\        /\
  41.         /    \    /    \        /\        /\        /\
  42.       /        \/        \    /    \    /    \    /    \
  43.    \/          4           \/        \/        \/
  44.     5                      3          2         1
  45.    ***********************************************************    }
  46. trofs_5 = (0-trough(ziggy,5))/5;
  47. trofs_4 = (0-trough(ziggy,4))/4;
  48. trofs_3 = (0-trough(ziggy,3))/3;
  49. trofs_2 = (0-trough(ziggy,2))/2;
  50. trofs_1 = (0-trough(ziggy,1));
  51. {       Average the length of days for peaks and troughs       }
  52. peaks_avg = peaks_5 + peaks_4 + peaks_3 + peaks_2 + peaks_1;
  53. peaks_avg = peaks_avg/5;
  54. trofs_avg = trofs_5 + trofs_4 + trofs_3 + trofs_2 + trofs_1;
  55. trofs_avg = trofs_avg/5;
  56. {   *********************************************************   }
  57. {                   Start MID TERM Analysis                     }
  58. {   *********************************************************   }
  59. prcnt1= prcnt *2;                   {change the dynamic percent}
  60. ziggy = ZIG(c,prcnt1,'%');
  61. peakm_5 = (0-peak(ziggy,5))/5;      {find the peak 5 waves ago}
  62. peakm_4 = (0-peak(ziggy,4))/4;      {the 0- is to convert to a +number}
  63. peakm_3 = (0-peak(ziggy,3))/3;
  64. peakm_2 = (0-peak(ziggy,2))/2;
  65. peakm_1 = (0-peak(ziggy,1));
  66. trofm_5 = (0-trough(ziggy,5))/5;
  67. trofm_4 = (0-trough(ziggy,4))/4;
  68. trofm_3 = (0-trough(ziggy,3))/3;
  69. trofm_2 = (0-trough(ziggy,2))/2;
  70. trofm_1 = (0-trough(ziggy,1));
  71. peakm_avg = peakm_5 + peakm_4 + peakm_3 + peakm_2 + peakm_1;
  72. peakm_avg = peakm_avg/5;                                   {averagethem}
  73. trofm_avg = trofm_5 + trofm_4 + trofm_3 + trofm_2 + trofm_1;
  74. trofm_avg = trofm_avg/5;                                   {averagethem }
  75. {   *********************************************************   }
  76. {                   Start LONG TERM Analysis                    }
  77. {   *********************************************************   }
  78. prcnt2= prcnt *4;                   {change the dynamic percent }
  79. ziggy = ZIG(c,prcnt2,'%');
  80. peakl_5 = (0-peak(ziggy,5))/5;      {find the peak 5 waves ago}
  81. peakl_4 = (0-peak(ziggy,4))/4;      {the 0- is to convert to a +number}
  82. peakl_3 = (0-peak(ziggy,3))/3;
  83. peakl_2 = (0-peak(ziggy,2))/2;
  84. peakl_1 = (0-peak(ziggy,1));
  85. trofl_5 = (0-trough(ziggy,5))/5;
  86. trofl_4 = (0-trough(ziggy,4))/4;
  87. trofl_3 = (0-trough(ziggy,3))/3;
  88. trofl_2 = (0-trough(ziggy,2))/2;
  89. trofl_1 = (0-trough(ziggy,1));
  90. peakl_avg = peakl_5 + peakl_4 + peakl_3 + peakl_2 + peakl_1;
  91. peakl_avg = peakl_avg/5;                                   {averagethem}
  92. trofl_avg = trofl_5 + trofl_4 + trofl_3 + trofl_2 + trofl_1;
  93. trofl_avg = trofl_avg/5;                                   {averagethem }
  94. {  *******************  Start Graphs  *********************  }
  95. OPENGRAPH(4,-peakl_avg,0);
  96. graph(1,'PRICE PEAKS',mov(c,peaks_avg/4,'s'),'S',
  97. mov(c,peakm_avg/4,'s'),'M',mov(c,peakl_avg/4,'s'),'L');
  98. graph(zig(c,prcnt,'%'),'Short Wave',zig(c,prcnt1,'%'),'Middle Wave',
  99. zig(c,prcnt2,'%'),'Long Wave');
  100. graph(stoch(peaks_avg/4,3),'Short',stoch(peakm_avg/4,3),'Middle',
  101. stoch(peakl_avg/4,3),'Long Stochastics');
  102. drawline(4,0,80,0,80);
  103. drawline(4,0,20,0,20);
  104. graph(1,'PRICE TROFS',mov(c,trofs_avg/4,'s'),'S',
  105. mov(c,trofm_avg/4,'s'),'M',mov(c,trofl_avg/4,'s'),'L');
  106. CLOSEGRAPH();
  107.