Stock forecasting is a complicated and daily challenge for investors because of the non-linearity of the market and the high volatility of financial assets such as stocks, bonds and other commodities. There is a need for a powerful and adaptive stock prediction model that handles complexities and provides accurate predictions. The support vector regression (SVR) model is one of the most prominent machine learning models for forecasting time series data. An ensemble hyperbolic tangent kernel SVR (HTK-SVR-BO) is proposed in this paper, combining Tanh and inverse Tanh kernels with Bayesian optimization. Combining the strengths of multiple kernels using the ensemble technique and then using optimization to identify the optimal values for each SVR model to enhance the ensemble model performance is possible. Our proposed model is compared with an ensemble SVR model (LPR-SVR-BO), which uses well-known SVR kernel types, including linear, polynomial and radial basis function (RBF). We apply the proposed models to Microsoft Corporation (MSFT) stock prices. The mean absolute error (MAE), mean squared error (MSE), root mean squared error (RMSE), R2 score (model accuracy) and mean absolute percentage error (MAPE) are the regression metrics used to compare the effectiveness of each ensemble model. In our comparison, HTK-SVR-BO performs better in terms of regression metrics compared to LPR-SVR-BO and achieves results of 0.27424, 0.13392, 0.36595, 0.99997 and 5.2331 respectively. According to the analysis, the proposed model is more predictive and may generalize to previously unknown data more effectively, so it can be accurate when forecasting future stock prices.