  The stock market presents a challenging environment for accurately predicting
future stock prices due to its intricate and ever-changing nature. However, the
utilization of advanced methodologies can significantly enhance the precision
of stock price predictions. One such method is Hidden Markov Models (HMMs).
HMMs are statistical models that can be used to model the behavior of a
partially observable system, making them suitable for modeling stock prices
based on historical data. Accurate stock price predictions can help traders
make better investment decisions, leading to increased profits.
  In this article, we trained and tested a Hidden Markov Model for the purpose
of predicting a stock closing price based on its opening price and the
preceding day's prices. The model's performance has been evaluated using two
indicators: Mean Average Prediction Error (MAPE), which specifies the average
accuracy of our model, and Directional Prediction Accuracy (DPA), a newly
introduced indicator that accounts for the number of fractional change
predictions that are correct in sign.
