I have started reading about HMM it gives an intuitive idea about what HMM is all about. I am looking out for example where its applied to Equity model using R / Excel. The material which I read so far is about its application to speech recognition.
Systematic Investor also did a two part series implementation in R which is also quite helpful as he details the pitfalls too.
Updated version after the 'RHmm' library was taken down from CRAN repository: http://systematicinvestor.github.io/Regime-Detection-Update
The clearest and most intuitive article I have seen so far is
Kritzman et al., Regime Shifts: Implications for Dynamic Strategies in FAJ (May / June 2012)
It not only shows how you can use HMM for financial modelling but it also goes through the actual estimation algorithm (Baum-Welch) step-by-step and even gives full MATLAB-code.
From the abstract:
Regime shifts present significant challenges for investors because they cause performance to depart significantly from the ranges implied by long-term averages of means and covariances. But regime shifts also present opportunities for gain. The authors show how to apply Markov-switching models to forecast regimes in market turbulence, inflation, and economic growth. They found that a dynamic process outperformed static asset allocation in backtests, especially for investors who seek to avoid large losses.
(I am not aware of a freely accessible copy of the paper - if you find one, please include it in a comment - I will change the answer accordingly.)
For your own experiments with HMM in R you can use the RHmm package.
Unfortunately the RHmm package has been deprecated. A good alternative seems to be the depmixS4 package.
Have a look at the following two papers, one from Chris Rogers and Liang Zhang where they introduce a model using HMM which captures stylized facts of financial returns. And the second where we extended this model to risk measures.
Implementation in R is strait forward using ML as mentioned in the paper.