AEI-DNET: A Novel DenseNet Model with an Autoencoder for the Stock Market Predictions Using Stock Technical Indicators

Predicting stock market prices is an important and interesting task in academic and financial research. The volatile nature of the stock market means that predicting stock market prices is a challenging task. However, recent advancements in machine learning, especially in deep learning techniques, have made it possible for researchers to use such techniques to predict future stock trends based on historical financial data, social media news, financial news, and stock technical indicators (STIs). This work focused on the prediction of closing stock prices based on using ten years of Yahoo Finance data of ten renowned stocks and STIs by using 1D DenseNet and an autoencoder. The calculated STIs were first used as the input for the autoencoder for dimensionality reduction, resulting in less correlation between the STIs. These STIs, along with the Yahoo finance data, were then fed into the 1D DenseNet. The resultant features obtained from the 1D DenseNet were then used as input for the softmax layer residing inside the 1D DenseNet framework for the prediction of closing stock prices for short-, medium-, and long-term perspectives. Based on the predicted trends of the stock prices, our model presented the user with one of three suggested signals, i.e., buy, sell, or hold. The experimental results showed that the proposed approach outperformed the state-of-the-art techniques by obtaining a minimum MAPE value of 0.41.


Introduction
Predicting stock market prices has always been challenging [1,2] because of their long-term instability. The old market theory considers it difficult to forecast stock prices and that stocks perform at random. However, current scientific investigations indicate that high stock standards are reflected in earlier archives. Therefore, knowledge of the change developments is required to forecast values efficiently [3]. Furthermore, stock market companies and movements are influenced by numerous financial aspects, such as governmental proceedings, common commercial circumstances, product value indicators, stockholders' anticipations, development of more stock markets, and the consciousness of shareholders [4]. The cost of stock units is calculated through high-level market capitalization. Various scientific factors allow numerical facts regarding the stock values [5]. Usually, stock indicators are increased from rates of stocks, along with high-level market assets, and they frequently evaluate the financial status in every nation. For instance, discoveries demonstrated that financial development in countries is certainly squeezed by stock market capitalization [6]. The description of a stock price change is vague and becomes risky for shareholders. Additionally, it is generally hard to identify the market significance for the administration. The stock principles are mostly vibrant, nonlinear, and • Present a novel framework for stock price prediction, namely, AEI-DNET using 1D DenseNet and an autoencoder, reducing the training and testing time complexities. • Propose a method to predict the buy/sell/hold signal based on the short-, medium-, and long-term predictions made by the 1D DenseNet framework. • Propose a robust framework for stock market prediction due to efficient STIs selection using an autoencoder. • Present a framework that predicted the future stock prices and helped the decisionmakers decide their actions, i.e., buy, sell, or hold. • Obtain state-of-the-art performance over the Yahoo Finance data due to the ability of DenseNet to present the complex price transformations in a viable manner. The rest of the paper is organized as follows: Section 2 provides an overview of the research already carried out. Section 3 has a detailed description of the proposed method. Section 4 provides extensive dataset details, evaluation parameters, experimentation, and obtained results. In Section 5, we conclude the paper.

Related Work
This section presents existing work performed for predicting stock market trends via using stock technical indicators (STIs). The methods used for stock market price prediction are classified into two types: an ML-based approach or DL-based methods.
Liang et al. [17] proposed an ML-based approach to predict future stock prices. Initially, a detailed set of 40 financial ratios (FRs), along with 21 corporate governance indicators (CGIs), were collected for US companies. To obtain more robust results for stock prediction, six specific FRs and CGIs were selected to train the SVM classifier. The method [17] showed better stock prediction results than other methods; however, the model should be evaluated over a more challenging and larger dataset. In [18], 10 STIs were used to train three classifiers: SVM, KNN, and ANN. This method attained the best performance with the SVM classifier; however, the noisy samples severely affected forecasting accuracy. Chuna et al. [19] proposed a framework to examine the relationship between one-day-ahead stock instability and STIs. To accomplish this, the model-free implied volatility index (VKOSPI) and STIs were used to predict stock behavior. This work was robust regarding stock price prediction; however, performance still requires enhancements. Dai et al. [20] introduced a method for stock return predictability by introducing new STIs. The work used three recognized technical trading principles, i.e., exponential moving average rules, relative strength indices, and KDJ, to predict buy/sell signals using a complicated mathematical method that employed recent or previous data. Based on the new STIs, the work presented a two-step economic constraint model to predict stock returns. The work shows better stock movement prediction accuracy; however, evaluation is needed over a more challenging and standard dataset. Fayek et al. [21] introduced an ML-based approach, namely, the multiobjective genetic algorithm (MOGA) technique, to boost the parameters of four different STIs. The main purpose of this work was to predict annual profit, along with the Sharpe ratio. Over the 30 years of the DJIA (Dow Jones Industrial Average) stock index closing prices, the proposed work was trained. Evaluations confirmed that the boosted parameters could improve the model's future stock movement prediction accuracy. However, this work required extensive training data. Maguluri et al. [22] proposed an approach for stock trend prediction. After performing the preprocessing step, 50 STIs were selected to train the nonlinear SVM classifier. This work presented a low-cost solution to stock prediction; however, the performance degraded for noisy samples. Zhang et al. [23] introduced a technique for stock price prediction. The work introduced a two-stage ensemble ML framework, SVR-ENANFIS, to predict future stock movements by merging key points of support vector regression (SVR) with ensemble adaptive neuro-fuzzy inference system (ENANFIS). Initially, the SVR module was used for predicting the future values of STIs. In the next step, the ENANFIS module was employed to determine the closing price by using the output value of the first step. In the last step, the introduced framework, namely, SVRENANFIS, was evaluated on several stock data sets. The work improved the stock forecasting accuracy; however, it suffered from high computational costs due to its two-stage network.
Agrawal et al. [24] proposed a DL-based approach, namely, optimized long short-term memory (O-LSTM), to predict future stock movements by combining STIs. The model generated two results: (i) stock market price prediction and (ii) a decision to buy or sell something. The work presented a low-cost solution to stock market trend prediction; however, the performance needs further improvements. Another enhancement of the LSTM model was presented in [25], in which stock price reversal points were introduced via employing upward/downward reversal point keypoint sets. Initially, 27 STIs were generated by connecting the candlestick indicators and TIs. After this, a representative set of key points against each stock was calculated using URP/DRP prediction. The computed Electronics 2022, 11, 611 4 of 26 key points were used to train the LSTM framework to predict future stock trends. The approach was robust regarding stock price prediction; however, the prediction accuracy requires enhancements. Similarly, LSTM based approach was presented in [26] to give the prediction of stock prices using correlated STIs. This work improved the stock movement prediction performance; however, this was at the expense of increased computational cost. Lee et al. [27] introduced an approach for predicting stock prices by employing the concept of reinforcement. This work exhibited better future stock movement prediction accuracy; however, the concept should be evaluated over a large and challenging dataset.
Gu et al. [28] proposed an autoregressive RNN-based LSTM framework to incorporate the prediction loss during each step of model training. Moreover, several STIs were used as covariates to optimize the framework input at each step. This work took the stock price prediction task as a regression problem instead of a straightforward binary classification problem. The approach improved the stock price pattern prediction performance; however, it is an economically inefficient. Similarly, in [29], a DL-based approach was presented for stock prediction. After performing the preprocessing step, two approaches, namely, hierarchical NN and bidirectional encoder representations from transformers (BERT), were applied to deal with the textual representation of STIs. Then, the computed representations were used to train the LSTM framework to predict stock price patterns. The work enhanced the stock movements determination performance; however, the approach still lacks model qualitative interpretability. Vargas et al. [30] presented an approach for daily directional movements prediction of stock prices via employing a hybrid approach, namely, SI-RCNN. This model worked well for stock price prediction; however, the performance could degrade over events with substantial price changes. In [31], a graph-embedding layer-based LSTM approach was presented to predict a stock's future prices. Several STIs were used to train the LSTM framework to determine the stock movements. The work was computationally efficient; however, the prediction accuracy needs further improvements for denser graphs. A small-sized ANN framework comprising one hidden layer was proposed in [32] to predict future stock behavior. The STIs from several published stock data were used to train the proposed solution to determine the future stock movements. The approach reduced the computational complexity; however, it lacks the generalization ability. Nabipour et al. [1] proposed a method to predict future stock prices. Initially, ten STIs from four stocks were selected, later used to train several ML-and DL-based models, namely, Adaboost, XGBoost, ANN, RNN, and LSTM, to predict future stock behavior. This approach obtained the best results using the LSTM model; however, evaluation was performed on only four types of stocks. Yıldırım et al. [33] proposed a hybrid model employing both technical and financial data to predict future stock trends. The framework used two types of LSTM: macroeconomic LSTM and a technical LSTM framework. The macroeconomic LSTM approach used numerous financial indicators, such as interest, funds, and inflation rates, to perform the financial analysis. The second network was the technical LSTM framework, which performed technical analysis using several technical indicators, such as moving average and convergence. Initially, financial and technical analysis were performed separately to check their impact on directional movement. The computed results from both modules were joined to give the stock future price prediction in the next step. The work was robust regarding stock price prediction; however, the performance degraded for real trading.

Proposed Methodology: AEI-DNET
The presented solution comprised of three main steps: (i) Initially, we gathered ten years of financial data from Yahoo Finance. Then we calculated eighteen stock technical indicators (STIs) from the obtained stock data. (ii) The computed STIs were passed as input into the autoencoder for dimensionality reduction in the next step. The resultant STIs with lower correlations and the Yahoo Finance data were passed into a 1D DenseNet framework to calculate the deep features. (iii) Finally, the computed features were used as input to train the softmax layer residing in the 1D DenseNet framework for stock trends prediction. The entire framework is presented in Figure 1, and step-wise pseudo code is presented in Algorithm 1.

Proposed Methodology: AEI-DNET
The presented solution comprised of three main steps: (i) Initially, we gathered ten years of financial data from Yahoo Finance. Then we calculated eighteen stock technical indicators (STIs) from the obtained stock data. (ii) The computed STIs were passed as input into the autoencoder for dimensionality reduction in the next step. The resultant STIs with lower correlations and the Yahoo Finance data were passed into a 1D DenseNet framework to calculate the deep features. (iii) Finally, the computed features were used as input to train the softmax layer residing in the 1D DenseNet framework for stock trends prediction. The entire framework is presented in Figure 1, and step-wise pseudo code is presented in Algorithm 1.

Data Acquisition and Preprocessing
In this work, we took data of ten companies from a renowned financial web portal, namely, Yahoo Finance. For each stock, we took 2640 data points per trading day, where each datapoint comprised high and low prices, daily open and close values, paid dividends, trading volume, etc. After the data acquisition, we performed the data preprocessing step, which involved guessing the missing price values from the available adjacent price values via employing a linear regression approach. After gathering the data, we split it into two sets: the training and testing datasets.

Datapoints Labeling
Our work predicted the future stock prices by categorizing each stock into three classes: buy, hold, and sell. We assigned a class label to each data point based on the upcoming behavior of their closing prices and selected forecast horizon. Our work is based on a three-class classification problem, three types of labels, namely, 'buy' indicated as 10, 'sell' indicated as 01, and 'hold' indicated as 00, were assigned to each data point.
The labels were assigned by using the equation.
Here, d(t) is the initial day, while f (s) shows the selected forecast horizon. Moreover, P d+ f and P d exhibit the closing prices on day d and d + f respectively, and δ indicates the threshold value. The label 'buy' is assigned to a datapoint if the related closing stock price goes up from the selected threshold, a data point is labeled as 'sell' if the corresponding closing stock price goes down from the selected threshold, and a data point is assigned as 'hold' if the change in the stock price remains between the negative and positive thresholds. The threshold value presents a slight relative change in the stock price, i.e., its rise or fall, which can be considered a directional movement [18]. Various chosen threshold values for our work over numerous forecast horizons are demonstrated in Table 1. The value of the threshold was selected so that each class contains about one-third of the data points. Moreover, the value of the threshold rises with the increase in the horizon as the price value also increases with time, which needs a large threshold number to put one-third of the data points into the 'hold' class.

Stock Technical Indicators
Stock technical indicators are statistical features of stock data calculated by incorporating various mathematical formulas to establish a fair estimation of prices and volumes. Some of the most used technical indicators are various variants of a moving average, momentum oscillators, and various flow indices. The following subsections provide a brief description of each STI incorporated in our work. A common STI presents the price average over a selected range, mostly containing closing prices (C p ), using the total number of days in that range [20].

Weighted Moving Average (WMA)
This STI is used to generate the trade direction and make a buy or sell decision [34]. The WMA is calculated by multiplying each data observation by a predetermined weighting factor, which is described as Here, C p is the closing price each day over N days.

Exponential Moving Average (EA)
This STI is an enhanced form of the WMA, giving more importance to recent price data. It is used to track the stock prices at a specific time interval [35].

Relative Strength Index (RSI)
It provides a comparison of the current gains with losses. The main aim of this indicator is to show the ups and downs in the price trends of stock by considering its closing prices in a specified time interval [36]. The mathematical representation of STI computation is given by where EA n (DM +ve ) and EA n (DM −ve ) are calculated over a time interval of the N previous days equal to the IWL.

Chande Momentum Oscillator (CMO)
The CMO is another well-known STI that employs momentum to locate the relative behavior of stock by demonstrating its strengths and weaknesses in a particular period [37]. The CMO is computed using Here, for N days, the S h and S l are the summations of the higher and lower closes.

Williams Percent Range (Williams %R)
This STI is used to measure the overbought and oversold levels and to identify the entry and exit points in the market using the following equation [18]: Electronics 2022, 11, 611 8 of 26 Here, C p is closed price, and H N and L N show the high and low prices over N days, respectively.

Price Rate of Change (PRC)
This STI is used to demonstrate the correlated differences between the C p on forecasted data and the C p computed on N previous days [38]. The PRC is given by

Hull Moving Average (HMA)
The HMA is a directional trend indicator that captures the current state of the market by using the recent price action to determine whether conditions are bullish or bearish [39]. The HMA is computed using 3.3.9. Triple Exponential Moving Average (TEA) This STI smoothens the price fluctuation to make the trend identification easier, without the lag associated with the MA [40]. where

Directional Movement Index (DMI)
This STI identifies the direction of price movement by comparing prior highs and lows [41].

Psychological Line (PL)
This STI indicates the buying capability compared to selling by showing the fraction of numbers of rising days with the total days.

Commodity Channel Index (CCI)
This STI is employed to check the strength and trend direction of stocks, which can assist the buyers in decision making to avail a trade opportunity or not and to hold on to an existing trade [42]. The CCI is computed using Here, T s is the total sum of the closing high and low prices on day s. Moreover, the MA N is the MA of T s calculated for N days. This STI indicates the difference between the 3-day EA and the 10-day EA of the accumulation/distribution line [43].
3.3.14. Moving Average Convergence Divergence (MAD) This is another influential STI that shows the relationship between two running averages of stock prices [44]. This STI is calculated by taking the difference of the EA of 26 days from the EA of 12 days.

Stochastic Oscillator %K (SO)
The SO indicator [45] shows the comparison of a specific closing price of a stock to a range of its prices for a specific period T and determines whether a stock is highly sold or bought, as given in the following equation: Here, H M and L M are the mean highest high and low values over N days, respectively.

Moving Average Deviation (MD)
The MD indicator shows the deviation in price from the moving average (MA), and the computed deviated value is shown by histogram bars [46]. The mathematical calculation of MD is done using the following equation:

Rank Correlation Index (RCI)
The RCI indicator [47] is used to identify potential changes in market sentiment to expose turning points. RCI is the combination of price change data and time change data, which is given in the following equation:

Bollinger Bands (BB)
The BB STI [48] is a powerful indicator of stock market prediction that enables investors to properly identify the time when an asset is oversold or overbought. The mathematical description of BB is given as

Dimensionality Reduction
Once the STIs were calculated, the next step was to reduce the dimensions of the data features. This step is important in the sense that it helps reduce the required time for model training and storage space requirements. It helps remove multi-collinearity, which improves the interpretation of the parameters of the model. A model with very low dimensions is generally easier to train; it is also easier to visualize the output data.

Autoencoder
Despite the usage of DenseNet results in an efficient set of STI representations, the data still suffered from a high dimensional space. To deal with this issue, we employed the autoencoder technique. Autoencoder networks are feedforward NNs that can contain more than one hidden layer. This approach tends to reconstruct the input data to reduce the dimensions of input samples.
In an autoencoder [49], the input and output layers have similar dimensions; however, the hidden layers have different data dimensions since the data reduction occurs here. The encoder takes x j ∈ I d x and compressed it to y j ∈ I d y in the hidden layers via employing an activation function f (x) given by the following equation: Here, W is a weight matrix. The encoding process is achieved using the following equation: while the decoding process is achieved using the following equation: Here, g() is an activation function similar to f (x), and W t is another weighted matrix. Furthermore, x j denotes the decoded compressed input string.
The autoencoder computes the total reconstruction error for all samples using the following equation: where e j is the weighted reconstruction error for an individual sample.

Model Training
After calculating the STIs, we used them as the autoencoder input for dimensionality reduction and a reduction in correlation among STIs. For this purpose, we used the 1D DenseNet framework instead of 2D vectors because of the textual nature of our dataset.

1D DenseNet
The 1D DenseNet framework was used for deep features extraction in the presented approach. The main reason to select the DenseNet framework over the ResNet approach is that, although the ResNet network is capable of dealing with the problem of vanishing gradient descent to some extent, the ResNet approach is computationally complex, as the network parameters increase exponentially with the increase in the depth of architecture. In contrast, DenseNet can better overcome the issues of the ResNet approach by introducing densely connected CNNs. Therefore, the main motivation for using the DenseNet framework is to present an efficient and effective solution for stock price prediction.
The DenseNet framework comprises a dense block, which is a transition layer along with the bottleneck layer. The architecture of the DenseNet framework is presented in Figure 2, where it can be seen that it consists of an (N − 1)-layered network and a composite function (CF). The CF further contains ReLU, batch normalization, and the convolution function. More specifically, the input data from the Yahoo Finance dataset was passed to the 1D DenseNet framework for feature computation. The convolution layers computed the deep features from the sample data by using a kernel window size of 3. The entire DenseNet framework contained four dense blocks, with each block comprising four convolution layers. Furthermore, each convolution layer applied four methods named batch normalization, ReLU activation, and squeeze and excite operations, as discussed in [50].
Initially, the number of filters was set to 32 and increased by 16 after each step, which, in turn, caused an increase in the feature vector size due to the concatenation operation. The transition layer was introduced after each DB to perform the down-sampling step to deal with this. Figure 2, where it can be seen that it consists of an (N − 1)-layered network and a composite function (CF). The CF further contains ReLU, batch normalization, and the convolution function. More specifically, the input data from the Yahoo Finance dataset was passed to the 1D DenseNet framework for feature computation. The convolution layers computed the deep features from the sample data by using a kernel window size of 3. The entire DenseNet framework contained four dense blocks, with each block comprising four convolution layers. Furthermore, each convolution layer applied four methods named batch normalization, ReLU activation, and squeeze and excite operations, as discussed in [50]. Initially, the number of filters was set to 32 and increased by 16 after each step, which, in turn, caused an increase in the feature vector size due to the concatenation operation. The transition layer was introduced after each DB to perform the down-sampling step to deal with this. The Nth layer of the framework had N inputs, as the Nth layer took the outputs of all previous N − 1 layers, as seen in Equation (26): Here, , , , … . . are the feature maps from the previous N − 1 layers, which were joined to the Nth layer and indicated by . The Nth layer of the framework had N inputs, as the Nth layer took the outputs of all previous N − 1 layers, as seen in Equation (26): Here, [I 0 , I 1 , I 2 , . . . ..I N−1 ] are the feature maps from the previous N − 1 layers, which were joined to the Nth layer and indicated by I N .
Furthermore, the transition layer comprised convolution and pool layers. The bottleneck layer contained a 1 × 1 convolution layer, which was employed to minimize the size of feature maps and enhance computational efficiency.

Experimental Results
This section provides a detailed overview of the incorporated dataset, performed experiments, and evaluation parameters used for the evaluation of the experimental results. The model was implemented using the Python platform. The proposed technique was further evaluated by providing a comparative analysis with other models as well.

Dataset
This research work incorporated publicly available historical financial stock market data available at Yahoo Finance. The historical financial data obtained from the said platform has a total of seven columns containing Date, Open, High, Low, Close, Adj Close, and Volume. Description of these attributes is provided in Table 2. Additionally, we also calculated H − L (stock high minus low price) and O − C (stock open minus close price) for calculation purposes. Moreover, we also calculated some important stock technical indicators (STIs) and used them as input features for training the model. A detailed discussion regarding STIs was already done in the previous section. The dataset under consideration consisted of the ten previous years' financial records of ten different stocks. Detail of the stocks and dataset is provided in Table 3. We took the historical stock price data and STIs as input to the training model. We selected the Standard and Poor's 500 index series (S&P 500) as the base time-series measure related to financial time-series data. This series was built using the Yahoo Finance data posted over the past ten years. The information gained from this series served as the base for calculating the technical indicators and the target output, and the same was used as input into the training model. We created binary variables to indicate the expected output related to the target output. The value 10 indicated that the closing price was expected to go up compared with the closing price during the current day, meaning that the model shall indicate a buy signal. Similarly, the value 01 indicated that the close price was expected to go down the next day compared with the closing price reported on the current day, meaning that the model shall indicate a sell signal. Similarly, a 00 signal indicated that no significant short-term change in the closing price was expected, meaning that the model shall indicate a sell signal. We present a case study based on the S&P 500 with ten US stocks: FB, TWTR, INTC, AAPL, MSFT, GOOG, TSLA, WMT, AMZN, and PYPL. As discussed earlier, we obtained ten years of stock trading data from Yahoo Finance posted during the past ten years, i.e., from 1 October 2011 to 30 September 2021 (subject to availability). The experimental data consisted of daily trade information including LO, HI, OP, CL, AD, and VO, representing low, high, opening price, closing price, adjusted close price, and volume.
For the sake of understanding, Figure 3 presents a visualization of the dataset distribution. Trading data for all stocks were divided into two parts, i.e., training and testing data with a 30%:70% ratio (approximately), resulting in 1760 trading days' data for training and 756 trading days' data for testing purposes, except for FB and TWTR, as these stocks started posting their stock data from 19 May 2012 and 11 July 2013, respectively. This resulted in 1601 and 1316 trading days' data for FB and TWTR, respectively. We suspect that a relatively lower amount of training data for these two stocks may slightly affect the model performance.
where denotes the actual value, denotes the predicted value, and a total number of data points is represented by .

Experimental Results
The utility of our proposed system was demonstrated by testing six models: autoregressive moving average (ARMA), generalized autoregressive conditional heteroskedasticity (GARCH), support vector machine (SVM), feed-forward neural network (FFNN), long short-term memory (LSTM), and the proposed 1D DenseNet. The

Evaluation Parameters
We measured the reliability of the experimental results by incorporating several criteria, including the mean absolute error (MAE), root mean square error (RMSE), mean absolute percentage error (MAPE), average mean absolute percentage error (AMAPE), and percentage of correct trend (PCT). The first performance metric, i.e., MAE was presented in, where it is a commonly used approach in forecasting; it can be calculated using Equation (27). The RMSE can be calculated using Equation (28). The third performance evaluation parameter was MAPE, which was used to calculate the percentage error between the actual and predicted values. MAPE is described using Equation (29). The next parameter, i.e., AMAPE is given in Equation (30). Finally, the metric named PCT is used to evaluate the accuracy of predicted ups and downs and can be calculated using Equation (31).
where ϕ denotes the actual value, ϕ denotes the predicted value, and a total number of data points is represented by n.

Experimental Results
The utility of our proposed system was demonstrated by testing six models: autoregressive moving average (ARMA), generalized autoregressive conditional heteroskedasticity (GARCH), support vector machine (SVM), feed-forward neural network (FFNN), long short-term memory (LSTM), and the proposed 1D DenseNet. The value to be predicted was the closing price of the next day. We performed predictive experiments using Anaconda (Python), TensorFlow, and scikit-learn packages. There are various approaches for feeding the input variables into the model. The basic stock trading data (LO, HI, OP, CL, AD, and VO) were fed into the above-mentioned models as the input variables. Talking about the models, LSTM used four variations of input method: LSTIM-I, LSTIM-II, LSTIM-III, and LSTIM-IV. The LSTIM-I used the basic trading data. LSTIM-II took the trading data and technical indicators after being processed by the autoencoder. LSTIM-III took the trading data and technical indicators after all variables were processed by autoencoder. LSTIM-I and LSTIM-III did not involve any processing by the autoencoder. LSTIM-IV and the proposed 1D DenseNet took the trading data and technical indicators after processing only the STIs by the autoencoder.
These variations in the input method of LSTM are depicted in Figure 4. The first experiment aimed to predict the next day's closing price in the S&P 500. The experiment mainly involved four variations of test data: 75 days for short-term prediction, 150 days for medium-term prediction, and 300 days for long-term prediction. For each type of test, the remaining data were used as training data. The experimental results obtained from the short-, medium-, and login-term trading data are presented in Tables 4-18. It is evident from the results that our proposed model had better accuracy compared with other models while predicting the closing price for short-, medium-, and long-term trading data. It is obvious that our model had the best performance regarding RMSE, MAPE, MAE, and AMAPE, which had the smallest values, and PCT, which had the highest values.
for medium-term prediction, and 300 days for long-term prediction. For each type of test, the remaining data were used as training data. The experimental results obtained from the short-, medium-, and login-term trading data are presented in Tables 4-18. It is evident from the results that our proposed model had better accuracy compared with other models while predicting the closing price for short-, medium-, and long-term trading data. It is obvious that our model had the best performance regarding RMSE, MAPE, MAE, and AMAPE, which had the smallest values, and PCT, which had the highest values.                It was also evident from the results that the fourth input method of LSTM, i.e., LSTIM-IV, had the overall second-best performance regarding MAPE, AMAPE, MAE, RMSE, and PCT. This was due to the involvement of the autoencoder for the dimensionality reduction of STIs before forwarding to the model.   Closer predicted results to the actual line present a more accurate prediction. The performance of the proposed model regarding accuracy is presented in Figures 5-9. Additionality, an accuracy timeline for 300 trading days is presented in Figure 10. As expected, the model performance for the stock named FB was slightly degraded due to Closer predicted results to the actual line present a more accurate prediction. The performance of the proposed model regarding accuracy is presented in Figures 5-9. Additionality, an accuracy timeline for 300 trading days is presented in Figure 10. As expected, the model performance for the stock named FB was slightly degraded due to Closer predicted results to the actual line present a more accurate prediction. The performance of the proposed model regarding accuracy is presented in Figures 5-9. Additionality, an accuracy timeline for 300 trading days is presented in Figure 10. As expected, the model performance for the stock named FB was slightly degraded due to Closer predicted results to the actual line present a more accurate prediction. The performance of the proposed model regarding accuracy is presented in Figures 5-9. Additionality, an accuracy timeline for 300 trading days is presented in Figure 10. As expected, the model performance for the stock named FB was slightly degraded due to fewer training data for the said stock. As discussed earlier, this slight degradation in model training for the said class was due to the fact that FB and TWTR started appearing in the US stock markets from May 2012 and July 2013, respectively.  Although the short-term and medium-term predictions in stock data are more desirable in the stock market, the long-term prediction is also significant, as a prediction of the direction of stock prices is normally more important for value investing in the long term, resulting in wiser decisions in the short-and medium-term perspectives. For the classification part, the trained model provides suggestions to the investor using one of the three signals, i.e., buy, hold, and sell, depending on the short-, medium-, and long-term stock trends under consideration. For instance, if the prices are expected to go up in the short-and medium-term, the model may generate a buy signal. Similarly, if the prices are expected to go up in the short term but they are expected to go down in the medium-and long-term, the model may generate a sell signal. Finally, if the prices are expected to go down in the short term but are expected to go up in the medium term, then the model may generate a hold signal. Again, the above scenario is just an example scenario, and it is presented only for the sake of understanding. The model may generate a signal purely based on short-, long-, and medium-term stock trends.

Comparison with ML-Based Methods
In this section, we compare our results against well-known ML-based approaches, namely, random forest, gradient boosting, and XGBoost, where the obtained results are reported in Table 19. We compared the approaches both in terms of precision results and computational time. It is quite clear from Table 19 that our approach was more robust regarding stock market prediction, both in terms of forecasting and computational complexity. More specifically, the random forest approach showed the lowest prediction results with MAPE and MAE values of 3.18 and 54.06, respectively, along with the execution time of 1.316 ms. Meanwhile, the second-lowest values were acquired by the gradient boosting approach, with the MAPE and MAE scores of 2.54 and 43.59, respectively, with the execution time of 1.483 ms. In comparison, the proposed approach attained MAPE and MSE values of 0.41 and 8.12, respectively, with an execution time of 1.051 ms. The main reason for our approach's better stock prediction performance was its more accurate feature extraction power, which improved its recognition ability. Although the short-term and medium-term predictions in stock data are more desirable in the stock market, the long-term prediction is also significant, as a prediction of the direction of stock prices is normally more important for value investing in the long term, resulting in wiser decisions in the short-and medium-term perspectives. For the classification part, the trained model provides suggestions to the investor using one of the three signals, i.e., buy, hold, and sell, depending on the short-, medium-, and long-term stock trends under consideration. For instance, if the prices are expected to go up in the short-and medium-term, the model may generate a buy signal. Similarly, if the prices are expected to go up in the short term but they are expected to go down in the medium-and long-term, the model may generate a sell signal. Finally, if the prices are expected to go down in the short term but are expected to go up in the medium term, then the model may generate a hold signal. Again, the above scenario is just an example scenario, and it is presented only for the sake of understanding. The model may generate a signal purely based on short-, long-, and medium-term stock trends.

Comparison with ML-Based Methods
In this section, we compare our results against well-known ML-based approaches, namely, random forest, gradient boosting, and XGBoost, where the obtained results are reported in Table 19. We compared the approaches both in terms of precision results and computational time. It is quite clear from Table 19 that our approach was more robust regarding stock market prediction, both in terms of forecasting and computational complexity. More specifically, the random forest approach showed the lowest prediction results with MAPE and MAE values of 3.18 and 54.06, respectively, along with the execution time of 1.316 ms. Meanwhile, the second-lowest values were acquired by the gradient boosting approach, with the MAPE and MAE scores of 2.54 and 43.59, respectively, with the execution time of 1.483 ms. In comparison, the proposed approach attained MAPE and MSE values of 0.41 and 8.12, respectively, with an execution time of 1.051 ms. The main reason for our approach's better stock prediction performance was its more accurate feature extraction power, which improved its recognition ability.

Comparison with Other Techniques
In this section, we present the comparison of our technique with other existing methods using the same dataset. To demonstrate the performance comparison, we accomplished the comparative analysis by comparing our methods through metrics, namely, MAPE and MAE, with the reported results of the approaches [1,[49][50][51]. The comparative results are given in Table 20. The reason for selecting the MAPE and MAE evaluation metrics was that researchers heavily explore these to demonstrate the stock prediction performance of the models. It is quite clear from the results reported in Table 20 that our work was more robust regarding stock market future trends predictions, as it shows lower MAPE and MAE values in comparison to the other latest approaches stated in [1,[49][50][51]. The main reason for the better performance of the proposed solution was due to the reliable feature extraction power of the 1D DenseNet, which presents the complex price transformations in a viable manner. In comparison, the competitor approaches [1,51] deploy very complex network architectures, which causes the production of over-fitted training data, ultimately reducing their performance. Therefore, it can be said that our work is more effective regarding stock market prediction.

Discussion
Stock trends prediction is an important topic of research and a challenging one due to the volatile, diverse, and dynamic nature of the stock market. Studies presented in recent years have revealed that STIs are a significant set of predictors for stock market future price estimation. However, the selection of more suitable STIs becomes a challenging task, as highly correlated STIs do not perform well in reliable feature extraction. To deal with the mentioned challenges, we presented a novel approach that employed both the STIs and stock data to make the final prediction. The main novelty of this work is that we are employing both STIs and finance data with a DL-based framework, which results in computing a more representative set of stock features. The evaluation results confirmed that the proposed approach attained robust prediction performance with reduced computational complexity. Therefore, we can say that our work can assist the business community in making timely beneficial decisions. The following are the advantages and limitations of our proposed method.

•
A novel framework employs STIs and stock data to predict future stock trends.
• Computationally efficient, as we employed an autoencoder framework for dimensionality reduction. • A robust approach that can assist the business community in making timely beneficial decisions.

•
The proposed approach predicts stock trends and provides intelligent decisions to hold, buy, or sell a product. • Our method's processing or prediction time was 1.051 ms, which is remarkable. • Proposed a novel approach that opened a new research area in the field of natural language processing or text analysis.

Limitations
• The model needs evaluation on an unseen database to show its generalization ability better.

•
This study is currently limited to the US stock market only. Therefore, a more generalized model shall enable us to include other stock markets, such as the Asian and European stock markets.

•
More DL-based frameworks can be tested with the employed technique to enhance the prediction accuracy further.

Conclusions
Stock market price prediction is a challenging and interesting task regarding financial, scientific, and academic research. Recent developments in machine learning, especially DL, have made it possible to predict future stock price trends based on historical events. Advanced machine learning algorithms have enabled researchers to use intelligent methods to predict stock prices based on social media posts, financial news, and stock technical indicators (STIs). The main focus of this work is to predict the stock market prices by using STIs and stock market data, such as daily closing prices.
As already mentioned, this work focuses on predicting the stock market closing prices based on the STIs by using 1D DenseNet, followed by dimensionality reduction using an autoencoder. We first gathered ten years of financial stock trading data from Yahoo Finance, then calculated eighteen STIs from these data and then fed these STIs, along with the stock trading data, into the 1D DenseNet model after dimensionality reduction of the STIs from the autoencoder. Finally, the computed feature set obtained from the 1D DenseNet framework was used as input for training the softmax layer residing in the 1D DenseNet framework for short-, medium-, and long-term prediction of the closing stock prices. Although the prediction of short-and medium-term predictions in stock data are more desirable in the stock market, the long-term prediction is also significant as a prediction of the direction of stock prices and is normally more important for value investing in the long term, resulting in wiser decisions in short-and medium-term perspectives. Based on the predicted trends of the stock prices, our model provides suggestions to the user using one of three signals, i.e., buy, sell, or hold.
This research focused on predicting the stock prices of US stock markets. We aim to extend this study to Asian and European stock markets in the future. Additionally, this study was limited to the prediction of closing prices at daily intervals. We are investigating the possibility of predicting the stock price fluctuation on a time interval shorter than one day. This investigation will require more fine-grained historical stock market data, which was unavailable in the current dataset. This task demands implementing a separate investigation and a different set of experiments, which can be considered future work.