This paper investigates the portfolio optimization under investor’s sentiment states of Hidden Markov model and over a different time horizon during the period 2004–2016. To compare the efficient portfolios of the Islamic and the conventional stock indexes, we have employed two approaches: the Bayesian and Markowitz mean-variance. Our findings reveal that the Bayesian efficient frontier of Islamic and conventional stock portfolios is affected by the investor’s sentiment state and the time horizon. Our findings also indicate that the investor’s sentiment regimes change the Islamic and the conventional optimal diversified portfolios.Moreover, the results show that the potential diversification benefits seem to be more important when using the Bayesian approach than when applying the Markowitz approach. This finding is valid for the bearish, depressed, bullish and calm states in Islamic stock markets. However, the diversification of potential portfolios is significant only for the bullish and the bubble states in the conventional financial markets.The findings of the study provided additional evidence for investors to exploit googling investor sentiment states to evaluate the portfolio performance and make an optimal portfolio allocation.