There are different approaches for the detection of market phase changes in stock markets. Most of them utilize various assumptions and constraints which makes these methods somewhat arbitrary. This paper develops an algorithm which identifies bull and bear markets retrospectively in a very robust way without using exogenous parameters. At the same time the algorithm is very easy to execute, can be applied to several time series frequencies and is intended to identify rather longer subperiods than shorter ones. Knowing the different phases one can investigate a multitude of characteristics of bull and bear markets.