Pattern recognition using hidden Markov models in financial time series