The market is modelled as a discrete-time Markov chain with three states — Bull, Neutral, Bear. At every step the next state is drawn from the current row of the transition matrix P, and that state's drift plus Gaussian noise sets the portfolio's return for the step. Because Pij depends only on the current state (not on history), the chain has no memory — the Markov property.
next state ~ Categorical(P[state, :])
return_t = drift(state) + noise · N(0,1)
balance_t = balance_(t-1) · (1 + return_t)
π P = π (stationary distribution, power iteration)
- Transition matrix — drag a cell to change Pij; the row auto-renormalises so probabilities always sum to 1.
- Noise — Gaussian volatility added on top of each state's mean drift.
- Stationary distribution — the long-run fraction of time spent in each state, computed by repeatedly multiplying an initial guess by P until it stops changing (power iteration).
- State graph — arrow thickness is proportional to the transition probability; the highlighted node is the chain's current state.
Real-world relevance: regime-switching models like this underlie risk management and asset-allocation systems that adapt exposure to bull/bear/neutral market conditions, and the same chain structure prices credit-rating migrations and interest-rate models.