  We address a portfolio selection problem that combines active
(outperformance) and passive (tracking) objectives using techniques from convex
analysis. We assume a general semimartingale market model where the assets'
growth rate processes are driven by a latent factor. Using techniques from
convex analysis we obtain a closed-form solution for the optimal portfolio and
provide a theorem establishing its uniqueness. The motivation for incorporating
latent factors is to achieve improved growth rate estimation, an otherwise
notoriously difficult task. To this end, we focus on a model where growth rates
are driven by an unobservable Markov chain. The solution in this case requires
a filtering step to obtain posterior probabilities for the state of the Markov
chain from asset price information, which are subsequently used to find the
optimal allocation. We show the optimal strategy is the posterior average of
the optimal strategies the investor would have held in each state assuming the
Markov chain remains in that state. Finally, we implement a number of
historical backtests to demonstrate the performance of the optimal portfolio.
