Predicting stock prices is notoriously difficult because financial data is noisy and non-linear. This study proposes a model designed to overcome common limitations in both data quality and predictive architecture.
We propose a framework that combines two methods. First, we use a Discrete Wavelet Transform (DWT) to clean the data, separating the underlying trends from market noise. Second, we feed this denoised data into a time-series recurrent neural network (TRNN). We optimized the TRNN by implementing the Swish activation function, which helps the model learn more effectively and mitigates the vanishing gradient problem. The model was validated using historical data from the Dow Jones Industrial Average (DJIA).
Our results show that a single-hidden-layer network performs significantly better than deeper and more complex networks. Deeper models perform poorly because they overfit clean data. Activation function was the most important factor for the success of this study. The Swish function allowed the model to learn effectively, whereas the older functions did not. The final best model had a very low error rate of 0.71%.
The proposed model achieves a 0.71% error rate, representing a 13-fold improvement over previous benchmarks. This study demonstrates that a streamlined, efficient model can outperform complex “deep” architectures when paired with robust data-cleaning techniques. These findings challenge the common belief that “deeper is better” in stock market forecasting.
1. Introduction
Accurately forecasting stock market movements is a major goal of financial research. Reliable predictions can lead to better strategies and higher returns for investors. Understanding market trends is important to ensure financial stability in a broader economy. Investors typically use two main types of analysis: fundamental analysis, which examines a company's intrinsic value, and technical analysis, which uses historical price and volume data to predict future movements [1, 2]. This study focuses on technical analysis using advanced machine learning methods.
However, generating precise predictions is extremely difficult because financial markets are complex and dynamic. They are influenced by many factors, from economic news and political events to general investor confidence [3]. This results in stock price data which are inherently noisy, non-stationary (i.e. their statistical properties change over time), and nonlinear (i.e. they do not follow simple, straight-line patterns) [4, 5]. This “noisy” nature of the data can easily confuse traditional statistical models such as ARIMA, as well as more advanced machine learning models, leading to suboptimal predictive performance [6].
Recurrent Neural Networks (RNNs), a type of deep learning, are designed to work with sequential data, such as stock prices. However, they also face two major hurdles. First, regarding data quality, if the input data are noisy, the model may learn incorrect patterns, leading to a phenomenon known as overfitting, wherein it performs well on historical data but poorly on new, unseen data. Second, at the model level, standard RNNs suffer from a significant technical limitation known as the “vanishing gradient problem [7, 8]”. This issue hinders the model's ability to learn effectively from temporally distant events, which is crucial for capturing long-term market cycles. This problem is exacerbated when older activation functions (a core component of neural networks), such as tanh and sigmoid, are used [9]. This study addresses these challenges by proposing an integration of two techniques. The proposed model first employs a Discrete Wavelet Transform (DWT) to denoise the input data. Subsequently, an improved Time-series Recurrent Neural Network (TRNN) model leveraging a modern activation function was used to perform the prediction. The primary objectives of this study are as follows:
To investigate and implement modern activation functions, specifically Swish, to mitigate the vanishing gradient problem and enhance the TRNN model's ability to learn from long-term time-series data.
To integrate a DWT into the preprocessing stage of the TRNN framework to serve as a robust denoising filter, effectively separating meaningful market trends from misleading high-frequency noise.
2. Literature review
2.1 Challenges in financial forecasting
Financial forecasting has a long history of research, driven by its inherent complexity and high economic stakes. The core challenge arises from the nature of financial markets. According to the Efficient Market Hypothesis (EMH), all available information is already reflected in the current stock price, which would make it impossible to consistently “beat the market” [10]. While the strong form of this hypothesis is widely debated, it highlights the extremely low signal-to-noise ratio in financial data; any predictable “signal” is often buried under a large amount of random “noise” [11].
Conventional time-series models, such as Autoregressive Integrated Moving Average (ARIMA) and Generalized Autoregressive Conditional Heteroskedasticity (GARCH), have been used for decades. While useful for understanding certain statistical properties of data, they are linear models and often fail to capture the complex nonlinear dynamics and sudden shifts that define real-world markets [6]. This limitation has pushed the research community towards more adaptive and powerful machine learning techniques [8].
2.2 Data denoising with wavelet analysis
Advanced preprocessing techniques are essential for addressing the problem of noisy data. One of the most effective methods for time-series data is Wavelet Transform (WT). Unlike the traditional Fourier Transform, which only provides information about the frequencies present in a signal, the WT provides time-frequency localization. This provides simultaneous resolution in both the time and frequency domains. This multi-resolution analysis is particularly suited for financial time-series, where market volatility and behavior can change suddenly.
The Discrete Wavelet Transform (DWT) works by breaking down a signal into different scales using a “mother wavelet.” This process separates the signal into two types of components:
Approximation Coefficients: These represent the low-frequency, high-scale components which capture the underlying trend.
Detail Coefficients: These represent the high-frequency, low-scale components associated with stochastic noise.
By applying a “threshold” to the detail coefficients (essentially setting the small, noisy values to zero) and then reconstructing the signal, the DWT can effectively remove noise while preserving the main trend [1, 12]. Studies have consistently shown that feeding a DWT-denoised signal into a machine learning model leads to significantly better prediction accuracy compared with using raw, noisy data [13–16].
2.3 Recurrent architectures and gradient dynamics
Deep learning models such as RNNs, have become state-of-the-art for many forecasting tasks. RNNs have an internal “memory” that allows them to learn from sequences of data. However, as mentioned, the vanilla RNN architecture are susceptible to the vanishing gradient problem, which limits their ability to retain long-term dependencies [9].
During the training process (called backpropagation), the model learns from its error. The “error signal” is sent backward through the network to update its internal weights. During backpropagation through time, the gradient is subjected to repeated matrix multiplications. If the eigenvalues of the weight matrices are small, the gradient decays exponentially, causing it to shrink until it becomes nearly zero. When the signal “vanishes”, the network stops learning from the past data.
This problem is directly linked to the network activation function, which is a mathematical function that introduces nonlinearity, allowing the model to learn complex patterns.
Legacy Functions (Sigmoid and Tanh): Early networks used functions such as sigmoid and tanh. These functions have an “S” shape and “saturate”, meaning they flatten out for very high or very low inputs. In these flat regions, their derivative (the learning signal) is nearly zero. The gradient vanishes because these near-zero numbers are repeatedly multiplied during backpropagation.
The ReLU Revolution: The introduction of the Rectified Linear Unit (ReLU) was a breakthrough [17]. Defined by the simple formula f(x) = max (0, x), ReLU does not saturate for positive input values. Its derivative is a constant 1, which means that the learning signal does not shrink, allowing for the training of much deeper networks. However, ReLU has a minor issue: the “dying ReLU problem”, where neurons can get stuck in the zero-output region and stop learning entirely.
Modern Functions (Swish and GELU): The newest generation of activation functions, such as Swish [18] and GELU [19], have further improved ReLU. They are smooth and non-monotonic (meaning they can dip down before going up). This added flexibility in their shape helps the optimization algorithm to obtain better solutions during training, leading to higher accuracy. Our research focuses on testing whether these modern functions can unlock the full potential of an RNN in financial forecasting [20, 21].
To solve the same problem, special RNN architectures, such as Long Short-Term Memory (LSTM) [2, 22] and Gated Recurrent Units (GRU) [23], have also been developed. They use internal “gates” to carefully control the flow of information, protecting the learning signal from vanishing. These models are now the standard for several sequence-based tasks. While LSTMs and GRUs mitigate gradient issues through gating mechanisms, they increase computational complexity and parameter counts. This study explores whether a simpler TRNN, when augmented with modern activation functions and DWT-based denoising, can achieve superior or comparable accuracy with greater efficiency [23].
3. Methodology
Our research method followed a systematic, multistage framework designed to rigorously test our hybrid model. The overall workflow, from data collection to the final evaluation, is shown in Figure 1.
3.1 Data and preprocessing
The dataset for this study is the historical daily closing price of the Dow Jones Industrial Average (DJIA), which is a key benchmark for the U.S. stock market. We collected the data from January 1, 1992, until April 30, 2019. It covers various market conditions, including bull markets, bear markets, and periods of high volatility.
The most critical preprocessing step is to denoise the “Close” price time series using the DWT. The goal is to create a clean, smooth signal that would be easier for the neural network to learn. The Denoising procedure was executed according to the following multi-step protocol:
Wavelet Selection: The Daubechies 4 (db4) wavelet was selected, which is a common choice in signal processing, owing to its good balance of smoothness and computational efficiency.
Multi-Level Decomposition: The “db4” wavelet was used to decompose the signal into four levels, which means that the signal was subjected to a four-level decomposition, each time separating the lower-frequency trend from the higher-frequency noise.
Coefficient Thresholding: The detail coefficients (noise) at each level were removed by setting them to zero. This step effectively filtered out random market fluctuations.
Signal Reconstruction: The signal was rebuilt using only the remaining approximation coefficients (the trend line).
This process, shown conceptually in Figure 2, results in a simplified time series that represents the core market trend, which is the signal that we aim to predict. Mathematically, the DWT of a signal x[n] is defined by (3.1) and (3.2), where h[k] and g[k] are the low-pass and high-pass filters, respectively.
3.2 Model and evaluation
The denoised time series was used to train and evaluate our TRNN model, which is a variant of the standard RNN architecture, as illustrated in Figure 3. The framework was implemented using Keras library in Python. Its architecture consists of a SimpleRNN layer that processes the input sequence, followed by a dense output layer that produces the final prediction.
To determine the best possible model, we conducted a comprehensive series of experiments to tune the model's hyperparameters. This involved systematically testing different values for:
Network Architecture: The number of hidden layers (from 0 to 6).
Hidden Nodes: The number of neurons in each layer (from 20 to 160).
Activation Function: tanh, Sigmoid (3.3), ReLU, GELU, and Swish (3.4).
Training Parameters: The number of training epochs, the learning rate, and the batch size.
Look-back Window: The temporal input horizon was varied (from 1 to 60).
The performance of each model configuration was measured using the Mean Absolute Error (MAE). We chose MAE due to its interpretability and scale-dependency, providing a direct representation of price deviation. A lower MAE indicates a more accurate model.
4. Result and discussion
Our experiments provide clear insights into what constitutes a successful prediction model for this task. We started with a baseline model using a multilayer architecture and the traditional tanh activation function. This initial model performed poorly, with an error rate of 36.94%. This result confirmed our hypothesis that the vanishing gradient problem is a major barrier to learning. Our subsequent experiments, in which we tuned one hyperparameter at a time, led to the following key findings.
4.1 Comparison on number of hidden layer
In the initial experiments, we used tanh activation function. Figure 4 shows the results on different number of hidden layers. Based on Figure 4, a model with a single hidden layer achieved the lowest error, whereas increasing architectural depth resulted in a precipitous decline in predictive accuracy. For example, a network with six layers failed with an error rate of over 50%. The initial experiments showed that a shallow network architecture is better than a deep network.
To confirm that this “less is more” principle was not unique to the tanh function, we conducted a second experiment comparing 1-layer versus 2-layer architectures across several modern activation functions. Figure 5 shows the results, which provide conclusive evidence for our findings. For every activation function tested, including Tanh, Sigmoid, ReLU, GELU, and Swish, the single-layer network (blue bars) consistently and significantly outperformed the two-layer network (orange bars).
Based on Figure 5, the results seem counterintuitive because deep learning often follows a “deeper is better” approach. However, in our framework, the DWT performs the “heavy lifting” of simplifying the data. Because the input signal is already very clean, a deep and complex network is not only unnecessary but also harmful, as it has too much capacity and starts to overfit the data, learning noise instead of the real trend. These results validate the “parsimony principle,” suggesting that for DWT-denoised signals, a streamlined architecture prevents the model from capturing residual stochastic artifacts.
4.2 Results on the different activation function
The activation function emerged as the primary determinant of model efficacy. This choice directly addresses the model's ability to learn over time. After determining the optimal architecture and training parameters, a final experiment was conducted to confirm the most effective activation function within the optimized framework. When we replaced the saturating tanh function with modern, non-saturating alternatives, the model performance improved dramatically. Figure 6 shows the error rate when we run on different type of activation functions.
Based on Figure 6, empirical results confirm that the Swish activation function consistently outperformed all other candidates. Its smooth, non-monotonic shape allows the model's optimization algorithm to navigate the complex loss landscape of the financial data more effectively, avoiding the pitfalls of vanishing gradients that cripple the tanh-based model. This finding provides definitive evidence that using a modern activation function is not just a minor tweak but a fundamental requirement for achieving high performance in RNN-based financial-forecasting.
4.3 Final model performance
By combining all the best-performing hyperparameters from our experiments, we constructed our final optimized model. The high-fidelity results are attributed to the synergy in integration of DWT-based signal extraction and the robust gradient dynamics afforded by the Swish function. The optimal configuration was as follows:
Architecture: One hidden SimpleRNN layer.
Hidden Nodes: 80.
Activation Function: Swish.
Learning Rate: 0.01.
Batch Size: 128.
Epochs: 10.
Sequence Length: 10.
This final lean model achieved an exceptionally low Mean Absolute Error of only 0.71%. This performance represents a significant departure from the baseline, establishing a new benchmark for this forecasting domain. Figure 7 shows the results, where 90% of the dataset was used for training and 10% for testing. Figure 7 provides a clear visual confirmation of this high accuracy, showing the model's predictions on the unseen test data exhibiting a high degree of correlation with actual price action.
To further validate the robustness of the model, its performance was also evaluated using 80% training and 20% testing data split. In this configuration, the model performed exceptionally well, achieving an error rate of 0.88%. The continued close fit shown in Figure 8 demonstrates that the high accuracy of the model is not limited to a single data partition but is a generalized characteristic of the optimized framework.
To properly understand the significance of this result, we compared it with the performance of the original TRNN benchmark and other standard forecasting models (Table 1). Our model's 0.71% error represents a 13-fold reduction in error compared with the original TRNN's error of 9.23%. This demonstrates the powerful synergistic effect of combining advanced data preprocessing with a carefully optimized and modern neural network architecture.
5. Conclusion and future work
In this study, we successfully developed and validated a hybrid DWT-TRNN framework that establishes a new performance benchmark in stock price prediction. By achieving a final error rate of just 0.71%, our results empirically validate the paradigm of architectural parsimony. These findings present a compelling challenge to the prevailing “deeper is better” heuristic in the deep learning community, demonstrating that strategic preprocessing can outweigh the benefits of model depth.
The success of our framework is rooted in a strategic “division of labor.” The DWT module acts as an expert signal processor, isolating the structural market trend from high-frequency stochastic noise. This allows the lean TRNN architecture to focus exclusively on learning temporal dynamics. This intelligent integration enables a single-layer network to outperform significantly more complex architectures, providing important implications for both practitioners and researchers: sophisticated data denoising often yields higher returns than the pursuit of costly, large-scale models.
This study has important implications for both financial practitioners and machine learning researchers. For quantitative analysts, investing in sophisticated data preprocessing can yield greater returns than simply building larger and more costly models. For researchers, it reaffirms the critical importance of choosing the right components, such as modern activation functions, which have proven essential for overcoming the fundamental learning barriers of traditional RNNs.
Although the results are highly promising, this study was limited to a single dataset. Future research should therefore focus on validating the robustness of this framework across a diverse portfolio of global financial instruments, including individual stocks, commodities, and cryptocurrencies, across various market conditions. Additionally, exploring the integration of more advanced recurrent units, such as LSTMs or GRUs, within this same lean, DWT-enhanced paradigm presents a promising avenue for potentially pushing predictive accuracy even further [24].
Based on the empirical comparative analysis, predefined train/test splits were used in the experiments. To further study the generalizability of the proposed methodology, future research can conduct a comprehensive split test or utilize other techniques such as k-fold cross-validation. This would help measure the extent to which the methodology can be generalized while maintaining an acceptable total expected loss.
The model was validated exclusively using the Dow Jones Industrial Average (DJIA). Although it is a major benchmark, its characteristics may not represent all financial instruments. Future work should focus on rigorously testing the robustness of the framework across a diverse portfolio, including individual stocks with varying volatilities, commodities, and highly nonlinear cryptocurrencies.
This study deliberately used a SimpleRNN to prove that architectural simplicity is a virtue when it is combined with effective preprocessing. However, more advanced recurrent units may capture the subtle dynamics of the denoised signal even more effectively. A key direction for future research is to integrate Long Short-Term Memory (LSTM) and Gated Recurrent Unit (GRU) cells into this same lean, DWT-enhanced paradigm to determine whether performance can be improved further.
While the db4 mother wavelet and specific decomposition coefficients were selected based on their established performance in similar time-series applications, this study focused primarily on the integration of the overall methodology. Future research could conduct a sensitivity analysis comparing various mother wavelets and decomposition levels. Such a study would provide deeper insights into how different signal decomposition strategies affect the optimization process and the resulting expected loss.
The proposed model relies solely on historical price data. It does not incorporate other data sources that heavily influence market movements, such as trading volume, market sentiment derived from financial news and macroeconomic indicators. Integrating these exogenous variables presents a significant opportunity to create a more holistic and potentially more accurate forecasting system [25].
Given the discussed limitations of the methodology and the scope of this study, it would be highly insightful to investigate the effectiveness of the proposed technique in other relevant markets. Future research can also focus on hybridizing the model with other effective approaches suggested in the literature or include additional features as previously described [26, 27]. This would allow researchers to assess the impact of these added elements and evaluate the trade-offs in terms of computational complexity.
In conclusion, this study demonstrates that the future of high-performance financial forecasting lies not in the brute-force pursuit of scale, but in the principled integration of signal processing, efficient learning architectures, and modern neural components.









