The attached is an implementation of the Bry-Boschan business cycle dating algorithm. For quarterly data, it implements the Pagan-Harding(2002) version.
Bry and Boschan (1971). "Cyclical Analysis of Time Series: Selected Procedures and Computer Programs", NBER, New York.
Pagan and Harding (2002) "Dissecting the cycle: a methodological investigation", Journal of Monetary Economics, Volume 49, Issue 2, 365-381.
@BryBoschan( options ) series start end
MA=width of centered MA used in final refinement [chosen based upon MCD criterion]
PRINT=[NONE]/FINAL/ALL - level of output desired
PEAK=(output) dummy variable series with 1's in the chosen peak entries
TROUGH=(output) dummy variable series with 1's in the chosen trough entries
These examples are based upon Mark Watson(1994), "Business Cycle Durations and Postwar Stabilization of the U.S. Economy", American Economic Review, vol 84, no 1, 24-46. The monthly example is from the paper itself, while the quarterly uses the same data set, but is compacted to quarterly.