  This paper is concerned with a stochastic linear-quadratic optimal control
problem with regime switching, random coefficients, and cone control
constraint. The randomness of the coefficients comes from two aspects: the
Brownian motion and the Markov chain. Using It\^{o}'s lemma for Markov chain,
we obtain the optimal state feedback control and optimal cost value explicitly
via two new systems of extended stochastic Riccati equations (ESREs). We prove
the existence and uniqueness of the two ESREs using tools including
multidimensional comparison theorem, truncation function technique, log
transformation and the John-Nirenberg inequality. These results are then
applied to study mean-variance portfolio selection problems with and without
short-selling prohibition with random parameters depending on both the Brownian
motion and the Markov chain. Finally, the efficient portfolios and efficient
frontiers are presented in closed forms.
