## 3 Research Methods
### Data Preprocessing  
Using daily stock prices, trading volumes, and nine technical indicators, a total of 14 variables were used to calculate daily technical indicators and input them into an NN for training. The model aims to predict the daily highest price, lowest price, and closing  
Figure 1: Flowchart of methodology.  
Figure 2: System framework.  
price, resulting in three separate models. Table 1 lists the input variables of the technical indicator [4] for the model predicting the highest price.  
Min-max scaling is a common normalization technique that scales the numerical feature data to fall within the range [0, 1]. This method helps to constrain the values within a specified range and accelerates the training speed of the model. The formula for normalization is as follows:  
\[x_{norm}=\frac{x-x_{min}}{x_{max}-x_{min}}\ \in[0,1] \tag{8}\]  
where:  
* \(x\) is the original value.
* \(x_{min}\) is the minimum value in the dataset.
* \(x_{max}\) is the maximum value in the dataset.
* \(x_{norm}\) is the normalized value.  
This approach ensures that the model accounts for the influence of the largest component stock, thereby improving the accuracy and stability of the predictions. This formula ensures that the scaled values lie within the [0, 1] interval. By applying min-max scaling, the features contribute equally to the model training process, thus improving the performance and convergence rate of the model.  
According to the experimental findings of [19], incorporating only the largest component stock can enhance the stability of the model. Given that TSMC holds the highest percentage among the component stocks in ETF50, this study considers only TSMC stock as training data. Initially, the ETF50 weights are set to 100%. Then, based on the proportion of TSMC within the ETF50 component stocks, the adjusted stock weights are calculated. Finally, the normalized data are multiplied by the adjusted weights.  
\[W_{T}=\sum W_{i} \tag{9}\]  
\[W_{\frac{W_{i}}{W_{T}}}=\frac{W_{i}}{W_{T}}\times 100\% \tag{10}\]  
where  
* \(W_{i}\) is stock weighting ratios.
* \(W_{T}\) is total stock weight.
* \(W_{\frac{W_{i}}{W_{T}}}\) is adjusted stock weighting (percentage)  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Variables** & **Attribute** & **Detail** \\ \hline \(X_{1}\) & High & Highest price \\ \(X_{2}\) & Deal & Trading volume \\ \(X_{3}\) & \(K\) & 9-day \(K\) value indicator \\ \(X_{4}\) & \(D\) & 9-day \(D\) value indicator \\ \(X_{5}\) & 6\(MA\) & 6-day moving average \\ \(X_{6}\) & 12\(MA\) & 12-day moving average \\ \(X_{7}\) & _BIAS_ 6 & 6-day bias \\ \(X_{8}\) & _BIAS_ 3–6 & 3–6 day bias (3-day bias–6-day bias) \\ \(X_{9}\) & _RSI_ 6 & 6-day relative strength index \\ \(X_{10}\) & \(W\%R\) 12 & 12-day Williams \%R indicator \\ \(X_{11}\) & _MTM_ 6 & 6-day momentum indicator \\ \(X_{12}\) & _MTM_ (Avg. 6) & 6-day momentum indicator moving average \\ \(X_{13}\) & _MACD_ & 9-day moving average convergence divergence indicator \\ \(X_{14}\) & _DIF_ & Difference value (short-term 12-day, long-term 26-day) \\ \hline \hline \end{tabular}
\end{table}
Table 1: Variables of the technical indicator inputs.  
When training an LSTM model, the data need to be segmented into a fixed-length via the sliding window concept. This means dividing the data into sequences of equal length, with a set sequence length of 20 days. Data from day 1 to day 20 serve as the input data to predict the stock price on day 21 as the model's prediction target. As illustrated in Figure 3, the data within the dark box represent the input data, while the red text indicates the prediction target for this iteration. Finally, the segmented data are divided into training and testing datasets, with 90% used as the training dataset and 10% as the testing dataset. Additionally, 10% of the training dataset is set aside as the validation dataset.