A hidden Markov model (HMM) is a statistical way to estimate unobserved market states from observable data. It can label periods as different regimes, but those labels are model estimates—not facts the market announces, and not proof that a strategy has an edge.
What a hidden Markov model sees
An HMM treats the market state as hidden and the prices or other measurements as observations generated under that state. The model estimates which state is more plausible from the observed sequence. In finance, researchers have applied latent-state models to variables including exchange rates, industry portfolios and order-book data; the University of Western Ontario thesis on HMMs in finance and an Ulster University record of a financial latent-state study describe that broader use.
A label such as “high volatility” is a convenient name an analyst may give a state after inspecting its estimated behaviour. The model's assumptions and inputs shape the states it can identify. The University of Western Ontario research and the Ulster University study both examine ways to estimate latent states in financial data; neither makes a state label an objective market fact.
How regime estimates become a rule
A trading system can use the estimated state as a filter: apply one pre-written rule in one state and another rule elsewhere, or reduce exposure when a chosen state is inferred. The HMM itself does not tell you which action is profitable. That requires a separate rule and an honest test.
| Model component | Question to settle before testing |
|---|---|
| Observations | Which returns, volatility measures or other inputs are available at decision time? |
| State count and meaning | How is the model selected, and are labels assigned without looking at later returns? |
| State estimate | Is the decision made from information available then, rather than a smoothed estimate using future observations? |
| Trading rule | What exactly changes when the estimated state changes, including costs and position constraints? |
The timing distinction matters. A model may estimate a past state using the full sequence, including later observations. That retrospective estimate can be useful for analysis, but it cannot be fed into a live-like backtest as though it had been known at the time. The financial HMM applications described by University of Western Ontario and Ulster University illustrate that model design is a substantive choice, not a neutral market label.
What the evidence can—and cannot—tell you
Published applications show that HMMs can be fitted to financial data, not that every regime filter improves trading. The University of Western Ontario thesis covers financial applications including regime-switching topics. An Ulster University study reports a particular latent-state model and pseudo-trading evaluation across several datasets. These are specific model-and-data experiments; neither establishes that a plain HMM filter works across instruments or future periods.
There is also a practical interpretation problem: a state is inferred, and the model's structure determines what it can represent. If you rename states after seeing which one had the best returns, or keep changing the number of states until the backtest improves, the apparent discovery may be selection rather than a stable feature. Treat a state description as a hypothesis to check, not an explanation by itself.
How you'd actually test it
Start with a simple strategy that does not use the HMM. Freeze its entry, exit and risk rules. Then specify the HMM inputs, state-count selection method, retraining schedule and decision-time estimate before examining the test period.
Run a chronological out-of-sample comparison between the unchanged baseline and the regime-filtered version. At each decision, fit or update the model using only data then available; keep any execution delay, trading costs and position limits identical. Record state transitions and verify that each action could have been generated at that timestamp. The existing market-regime backtesting explainer covers the broader problem of checking whether a strategy survives changing conditions. For how realbacktesting treats reproducibility, see its testing methodology.
Compare more than the final return: inspect turnover, drawdown, state occupancy and performance across separate periods. If a small change in inputs or sample boundaries flips the state map or erases the benefit, the regime story is fragile. A clean comparison still cannot prove a future edge; it can show whether the added model earned its complexity on data it did not help select.
The useful conclusion
An HMM can organise uncertainty into estimated states. Whether those states help is a separate, falsifiable question. Test the information available at the time, and make the baseline earn its place beside the more complicated model.