Bull Bear States¶
Bull and Bear are commonly mentioned market dynamics that assist in deploying certain strategies. In this module, two algorithms for bull and bear market detection have been implemented. Pagan and Sossounov’s and Lunde and Timmermann’s algorithms are commonly used to detect different market regimes.
Note
Underlying Literature
The following sources elaborate extensively on the topic:
A simple framework for analysing bull and bear markets by Pagan, A.R. and Sossounov, K.A.
Duration dependence in stock prices: An analysis of bull and bear markets by Lunde, A. and Timmermann, A.
Pagan and Sossounov¶
Influenced by Bry and Boschan’s paper (Cyclical Analysis of Time Series: Selected Procedures and Computer Programs, 1971. ), Pagan and Sossounov developed an algorithm to classify bull and bear states. The classification goes through four different filtering methods. The filtering steps are as followed:
Use a window length for both directions to determine local extrema.
Censor the first and last months to eliminate bias.
Remove cycles with length shorter than the given parameter.
Remove phases with length shorter than the given parameter unless if the change is greater than the threshold.
After each filtering method, the corresponding data undergoes an alternation filter that combines consecutive peaks and troughs.
Lunde and Timmermann¶
Lunde and Timmermann’s algorithm is based on realizing the absolute change from the highest or lowest point. Two parameters are used for Lunde and Timmermann: \(\lambda_1\) and \(\lambda_2\). The parameters are considered as switches that indicate the change of states.
Tip
In their paper, Lunde and Timmermann consider both symmetric (\(\lambda_1 = \lambda_2 =0.2\)) and asymmetric (\(\lambda_1 = 0.2, \lambda_2 = 0.1\)) parameters.