I don't understand how technical indicators are at all relevant to the question. State probabilities can be generated directly from the returns if the model is known. There is no need to guess at heuristic trading rules based on technical indicators.
Let $r_t$ be the return at time $t$. Your model is
- $E\{r_t | s_t=i\} \sim N(\mu_i,\sigma^2_i), i=0,1$
- $P\{s_t=i | s_{t-1}, s_{t-2}, ...\} = P\{s_t=i|s_{t-1}\}$
In other words, the state is Markov and returns are normal with known mean, variance in either state. Suppose we are standing at time $t$. We need to first determine $P\{s_t = 0 | r_{t-1}, ..., r_0\} = p_t$. Use the forward backward algorithm aka dynamic programming and implemented in most HMM packages.
Now
$$E\{r_t\} = p_t\mu_0 + (1-p_t)\mu_1$$
and
$$Var\{r_t\} = p_t\sigma_0^2 + (1-p_t)\sigma_1^2.$$
Now we need to choose our position $x$ to maximize the Sharpe
$$\frac{E\{x'r\}}{\sqrt{Var\{x'r\}}}$$
This is equivalent (up to a scaling factor) to the mean-variance problem
$$\min_x \{\lambda x' \Sigma x - x'\bar{r} \},$$
where $\Sigma$ is a diagonal matrix with $Var\{r_t\}, t= 0,1,...,T$ on the diagonal and $\bar{r} = E\{r\}$. The proof of this fact is by contradiction. Suppose there is an $x$ with higher Sharpe that isn't the solution to the mean-variance problem, $x^*$. We can scale $x$ by a positive constant $\alpha$ so that we have $\alpha \bar{r}'x = \bar{r}'x^*$ . At the same time, we know that
$$\alpha\sqrt{x'\Sigma x} < \sqrt{(x^*) ' \Sigma x^*}$$
because $x^*$ isn't Sharpe-optimal. Squaring both sides gives
$$\alpha^2 x'\Sigma x < (x^*) ' \Sigma x^*.$$
The fact that $\alpha x$ has the same mean and strictly lower variance contradicts the assumption that $x^*$ is the solution. We thus conclude that the mean variance solution is always Sharpe optimal. Note that in more general problems (e.g. with constraints) this equivalence doesn't necessarily hold. Now the solution to the mean-variance problem (take derivative and set to zero) is just $\frac{1}{2 \lambda}\Sigma^{-1} \bar{r}$. However, at time $t$ we don't have to worry about anything other than $x_t$. It is possible to compute $x$ for future times that are optimal with respect to current expectations, but in practice it is better to re-run the forward-backward algorithm after we observe the next return and then re-compute $x_{t+1}$. The optimal solution therefore is to bet proportionally to $\frac{E\{r_t\}}{Var\{r_t\}}$. This has an intuitive interpretation as
$$\frac{E\{r_t\}}{Var\{r_t\}} = \frac{E\{r_t\}}{\sqrt{Var\{r_t\}}} \frac{1}{\sqrt{Var\{r_t\}}}$$
so that
$$x_t\sqrt{Var\{r_t\}} = \frac{E\{r_t\}}{\sqrt{Var\{r_t\}}},$$
i.e. take risk proportional to expected Sharpe at each time.
If you have transaction costs then you need to consider future means and variances, which makes the problem more difficult, but doable.