Trend Detection and Pattern Recognition in Financial Time Series