Indonesian Journal of Electrical Engineering and Computer Science Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 32 No. 8s (2025) 484 https://internationalpubls.com A Deep Neural Network Model for Forecasting Variable Stock Movement Intervals Dinesh Singh Dhakar1, Jagmeet Kaur2, Kiranjeet Kaur3, Bharti Kaushik4 Department Computer Science and Engineering1,2,3,4 Chandigarh University, Mohali, India1,2,3,4. dineshhodcsemit@gmail.com1, Jagmeet.bhangu03@gmail.com2, kiranresearch.phd@gmail.com3, Kaushikbharti.bk@gmail.com4 Article History: Received: 01-11-2024 Revised:08-12-2024 Accepted:29-12-2024 Abstract: Forecasting results for stock markets exhibit variabilities in forecasting accuracy as the tenure of prediction is varied. Typically stocks are predicted for long, short as well as mid term tenures based on the tenure of prediction. While longer tenures have relatively much larger data to be trained as training data, divergences are also potentially large as the forecasting period may render higher randomness due to unprecedented events. The short term forecasting is relatively less prone to unprecedented events due to the tenure of forecasting. However, the lesser amount of training data may result in less accurate pattern recognition. A common ground is typically found in terms of mid term forecasting. This paper presents an experimental evaluation of all three formats of forecasting based on the training, testing split. The deep neural network model is used for the forecasting purpose and the forecasting MAPE and accuracy has been tabulated for a multitude of stocks. It has been shown that the proposed approach attains an MAPE of only 2.18% outperforming existing work in the domain. Keywords: Stock Market Forecasting, Deep Neural Networks, Variable Forecasting Tenures, Forecasting MAPE, Forecasting Accuracy. I. INTRODUCTION Stock movement forecasting is a crucial aspect of financial markets and investment decision-making. Several factors contribute to the necessity and importance of predicting stock movements. Typically, financial markets are inherently volatile, influenced by a myriad of factors such as economic indicators, geopolitical events, and market sentiment [1]. Forecasting stock movements helps investors and traders navigate through this uncertainty, allowing them to make informed decisions and mitigate potential risks. Accurate stock movement forecasts are essential for effective risk management. Investors need to anticipate potential price fluctuations to implement strategies that protect their portfolios from adverse market conditions [2]. By understanding the potential risks, investors can make better-informed decisions about portfolio diversification and asset allocation. Investors rely on stock forecasts to make strategic investment decisions [3]. Whether it's choosing when to buy or sell a stock, enter or exit a market, or adjust portfolio holdings, accurate predictions enable investors to capitalize on opportunities and avoid losses. Timely and precise information is critical for optimizing investment strategies [4]. Forecasting stock movements aids in optimizing investment portfolios. By identifying trends and correlations, investors can adjust their portfolio mix to achieve a balance between risk and return. This optimization process involves considering factors mailto:dineshhodcsemit@gmail.com1 mailto:Jagmeet.bhangu03@gmail.com2 mailto:kiranresearch.phd@gmail.com3 mailto:Kaushikbharti.bk@gmail.com4 Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 32 No. 8s (2025) 485 https://internationalpubls.com such as asset class performance, sectoral trends, and the overall economic outlook. In today's digital age, algorithmic trading and automated systems heavily rely on stock movement forecasts [5]. These systems use historical data, technical indicators, and machine learning algorithms to predict future price movements. Investors and institutions use these automated tools to execute trades swiftly and efficiently. Typically, stock market forecasting can be categories based on the tenure of training and testing intervals [6]. Typically, the intervals defined are: 1) Short 2) Mid 3) Long Sometime ultra short and ultra long term forecasts are also analyzed, though they are under the sub domain of short and ling term forecasts [7]. II. INCORPORATING GLOBAL FACTORS THROUGH OPINION MINING To incorporate global influencing factors, opinion mining and sentiment analysis has been extensively employed. Opinion mining, also known as sentiment analysis, involves analyzing public opinions, attitudes, and emotions expressed in textual data [8]. Applying opinion mining to stock market forecasting involves extracting sentiment from financial news, social media, and other sources to gauge investor sentiment and potential market trends. The first step in opinion mining for stock market forecasting is the collection of relevant textual data [9]. This data can include financial news articles, social media posts, analyst reports, and other sources. Text processing techniques, such as natural language processing (NLP), are then applied to preprocess and clean the data for sentiment analysis [10]. Opinion mining employs various sentiment analysis techniques to determine the sentiment expressed in the collected texts. These techniques may include rule-based methods, machine learning algorithms, and deep learning models [11]. The goal is to classify the sentiment as positive, negative, or neutral, providing insights into how the market participants perceive certain stocks or the overall market. Sentiment analysis generates sentiment scores that quantify the degree of positivity or negativity in the expressed opinions. These scores can be aggregated over time to create sentiment time series data. High positive sentiment may indicate bullish market expectations, while consistently negative sentiment could signal bearish sentiments among investors [12]. III. PROPOSED MODEL The methodology of the proposed approach can be thought of as an amalgamation of data pre- processing, feature selection and training using deep neural networks. Each of the sections have their own importance. The methodology is presented in each of the following heads which comprise the algorithm. The variation of the tenure of training and testing has been leveraged to forecast long, short and mid term movement [13]. Data Pre-Processing: The DWT: Discrete Wavelet Transform (DWT) based filtering has gained attention in recent years as a powerful tool for signal processing, and it has found applications in stock market forecasting [14]. DWT is a Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 32 No. 8s (2025) 486 https://internationalpubls.com mathematical tool that decomposes a time-series signal into different frequency components or scales. In the context of stock market data, this means breaking down the original time series into various frequency bands or levels. High-frequency components may capture short-term fluctuations, while low-frequency components represent longer-term trends [15]. DWT-based filtering allows for the separation of signal and noise components. By decomposing the stock market time series into different scales, it becomes possible to filter out high-frequency noise, which may be attributed to market volatility or irregularities [16]. This noise reduction helps in extracting meaningful features from the data that are more indicative of underlying market trends. The multi-resolution property of DWT enables the identification of trend and cyclical patterns in stock prices. Improved signal quality allows for more accurate modeling and prediction of future stock prices [17]. DWT-based filtering not only aids in forecasting stock prices but also contributes to risk management strategies. By identifying trends and patterns at different time scales, investors can make more informed decisions about when to enter or exit the market. Understanding the underlying structure of the data helps in managing investment risks effectively [18]. The DWT can be mathematically expressed as [19]: ๐‘ญ(๐’™, ๐’š) ๐‘ซ๐‘พ๐‘ป๐Ÿ โ†’ ๐‘ช๐‘จ, ๐‘ช๐‘ซ, ๐‘ช๐‘ฏ, ๐‘ช๐‘ฝ (1) Here, ๐ถ๐ดrepresents the approximate co-efficient values. ๐ถ๐ทrepresents the detailed co-efficient values. ๐ถ๐‘‰represents the vertical co-efficient values. ๐ถ๐ปrepresents the horizontal co-efficient values. ๐ท๐‘Š๐‘‡2represents the discrete wavelet transform on the actual data. The idea is to keep the ๐ถ๐ด values while removing the ๐ถ๐ท values so that the data can be filtered. The filtered data is then applied to the deep neural network model. Moving Window: To sample the recent trends in the data, a two way moving filter based windowing has been employed in this work which captures the recent (๐‘™ โˆ’ ๐‘š) ๐‘ ๐‘Ž๐‘š๐‘๐‘™๐‘’๐‘  of the data. This is fed as an additional sliding input to the training vector: ๐’ ๐Ÿ โ‰ค ๐’Œ โ‰ค ๐’ (2) Here, ๐‘› is the number of samples for forecasting. ๐‘˜ is the length of the sliding window. We also introduce an additional parameter, ๐‘Ÿ๐‘˜, in the range ๐‘˜๐œ–[ ๐‘› 2 , ๐‘›], such that, ๐’“๐’Œ = ๐๐’š(๐’,๐’Œ) ๐๐’ โˆ€๐’Œ๐[ ๐’ ๐Ÿ , ๐’] (3) Here Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 32 No. 8s (2025) 487 https://internationalpubls.com ๐‘Ÿ๐‘˜ signifies the rate of change of the target in the sliding interval of [ ๐‘› 2 , ๐‘›]. Deep Neural Network Model for Pattern Recognition: Several approaches have been explored to forecast stock trends accurately but one of the most effective techniques happens to be the deep neural network model. The algorithm proposed in this approach aims to reduce the swing or overshoot of the training algorithm while attaining convergence [19]. Algorithm The algorithm of the proposed approach is presented subsequently: Step.1 Extract dataset and divide data into the ratio of 70:30 for training : testing. Step.2 Apply DWT to filter data by keeping the ๐ถ๐ด values while removing the ๐ถ๐ท values Step.3 Apply dual averaging window of (๐‘™ โˆ’ ๐‘š) ๐‘Ž๐‘›๐‘‘ ๐‘ ๐‘Ž๐‘š๐‘๐‘™๐‘’๐‘  ๐‘Ž๐‘›๐‘‘ ๐๐’š(๐’,๐’Œ) ๐๐’ โˆ€ ๐‘˜ ๐œ–. Step.4 To train the network, employ the following training rule: ๐’—๐’‚๐๐’˜ = ๐’Ž๐’—๐’‚๐๐’˜ + (๐Ÿ โˆ’๐’Ž)๐๐’˜ (4) Here, ๐‘ฃ๐‘Ž represents the learning velocity along โ€˜aโ€™. ๐‘š represents the momentum factor ๐‘ค represents the weights. ๐œ•๐‘ค represents the differential weights Step.5 If (cost function stabilizes) Truncate training Else if (max. iterations are over) Truncate Training Else Feedback errors as inputs to subsequent iteration. Step.6 if (error is stable through validation checks i.e. 6 consecutive iterations) Stop training else if (maximum iterations are over even without error stabilization) Stop Training else { Feed next training vector Back propagation of error } Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 32 No. 8s (2025) 488 https://internationalpubls.com Step.7: Vary the training testing tenure from the dataset extracted to forecast for: a) Long Term b) Mid Term. c) Short Term Step.8 Compute performance metrics. The experimental results are presented subsequently. 5. EXPERIMENTAL RESULTS The experimental simulations have been done on MATLAB 2024 on a PC with Intel i7 processor and 32GB RAM. The experimental results have been presented in this section with variations in the forecasting samples so as to incorporate long, mid and short term forecasting. The Tesla stocks over a ten year period has been used for evaluating the performance of the proposed algorithm. A similar approach can be employed for all the other stocks. Fig.1 Statistical Features of Raw Data Figure 1 depicts the statistical features of the raw data. Table 1: Statistical feature of raw data S.No. Parameter Value 1 Samples 3020 2 Min 1.455 3 Max 410 4 Mean 61.27 5 Median 96.8 The statistical features of the data are presented in table 1, for the Tesla dataset. Fig.2 Long Term Forecast Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 32 No. 8s (2025) 489 https://internationalpubls.com Figure 2 presents the MAPE results for the Tesla stocks over a period of 1 year. It can be observed that the MAPE is 2.64%. Fig.3 Mid term forecast It can be observed from figure 3 that the proposed approach attains an MAPE of 5.14% for the mid- term forecast. Fig.4 Short term forecast It can be observed from figure 4 that the proposed approach attains an accuracy of 4.46%. Table 2. MAPE Comparison S.No. Duration Days Ahead MAPE Accuracy% 1 Long Term 365 2..64 % 97.36% 2 Mid Term 100 5.14 % 94.86% 3 Short Term 10 4.46 % 95.54% 4. Mean MAPE 3% 97% The comparative analysis of the MAPE for all the 3 forecasting models indicate the following: 1) The long term forecast yields the minimum MAPE thereby rendering maximum accuracy of forecasting, for the Tesla stocks. 2) The mid term forecast attains the maximum MAPE thereby rendering the minimum accuracy for the Tesla stocks. 3) Short term forecasting attains slightly lower MAPE than mid-term forecasting for the Tesla stocks. Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 32 No. 8s (2025) 490 https://internationalpubls.com A similar analysis has been done for stocks such as Microsoft, Google, Amazon, Apple and IBM. The mean MAPE obtained over all stocks happens to be 2.18%. A comparative analysis in terms of forecasting MAPE is presented in table 3. Table 3. Comparison with Previous Work S. No. Authors Approach MAPE 1. Kim et al. [20] Transfer Entropy Augmented Feature Learning 43% 2. Li et al. [21] LSTM with Sentiment Analysis 51.4% 3. Althelaya et al. [22] EWT with Stacked LSTM SWT with Stacked LSTM 5.548% 12.888% 4. Gao et al. [23] Genetic Algorithm with Multi Branch CNN (GA- MBCNN) 17% (best case) 5. Subbakar et al. [24] ARIMA 14% 6. Gulmez et al. [25] LSTM-ARO LSTM-GA LSTM1D LSTM2D LSTM3D 6.58% 7.583% 8.889% 8.659% 8.784% 6 Ray et al. [26] BERT-LSTM GRU TCN Deep transformer MB-TCN 28% 26% 20% 18% 16% 8.. Zhan et al. [27] Sliding Window with LSTM 5.61% (best case) 9. Proposed Approach Momentum Based Gradient Descent, with sampled window and Sentiment Analysis. 2.18% (Over all stocks) A comparison with existing approaches such as Effective Transfer Entropy [20], LSTM combined with Sentiment Analysis [21], Empirical Wavelet Transform (EWT) with LSTM [22], GA with MBCNN [23], ARIMA [24]GA-SLTM and GA-ARO [25], BERT-LSTM, GRU, TCN, Deep Transformer, MB-TCN [26] and Sliding Window with LSTM [27] based models. Thus the proposed approach comprising of the DWT and moving average gradient combined with sentiment analysis clearly outperforms baseline approaches in terms of the mean absolute percentage error (MAPE). CONCLUSION This paper presents a DWT-Neural Network based approach for forecasting stock trends over a varied interval period. The categorization of the forecasting has been done based on the number of samples ahead in forecasting. A 365, 100 and 10 day split has been chosen for the long, mid and Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 32 No. 8s (2025) 491 https://internationalpubls.com short term forecasts respectively. An illustration analysis has been made for the Tesla stocks over the variable forecasting period. It has been shown that the proposed approach attains a forecasting accuracy of 97.36%, 94.86% and 95.54% for long, mid and short term forecasts respectively, with a mean MAPE of 3% across all intervals of forecast. The model also attains an MAPE of 2.18% across various stocks for benchmark S&P 500 dataset obtained from Yahoo Finance. A comparative analysis with existing models shows that the proposed approach outperforms the baseline approaches in terms of forecasting accuracy. References [1] Y. Wang and Y. Guo, "Forecasting method of stock market volatility in time series data based on mixed model of ARIMA and XGBoost," in China Communications, vol. 17, no. 3, pp. 205-221, March 2020. [2] A. Thavaneswaran, Y. Liang, Z. Zhu and R. K. Thulasiram, "Novel Data-Driven Fuzzy Algorithmic Volatility Forecasting Models with Applications to Algorithmic Trading," 2020 IEEE International Conference on Fuzzy Systems (FUZZ-IEEE), Glasgow, UK, 2020, pp. 1-8. [3] B. D. Shivahare, S. Suman, S. S. N. Challapalli, P. Kaushik, A. D. Gupta and V. Bibhu, "Survey Paper: Comparative Study of Machine Learning Techniques and its Recent Applications," 2022 2nd International Conference on Innovative Practices in Technology and Management (ICIPTM), Gautam Buddha Nagar, India, 2022, pp. 449-454. [4] P. S. Sisodia, A. Gupta, Y. Kumar and G. K. Ameta, "Stock Market Analysis and Prediction for Nifty50 using LSTM Deep Learning Approach," 2022 2nd International Conference on Innovative Practices in Technology and Management (ICIPTM), Gautam Buddha Nagar, India, 2022, pp. 156-161. [5] S. M. Idrees, M. A. Alam and P. Agarwal, "A Prediction Approach for Stock Market Volatility Based on Time Series Data," in IEEE Access 2019, vol. 7, pp. 17287-17298 [6] S Sohangir, D Wang, A Pomeranets, โ€œBig Data: Deep Learning for financial sentiment analysisโ€, Journal of Big Data, Springer 2018, vol. 5, Article number. 3. [7] M Sadiq, CC Hsu, YQ Zhang, F Chien, โ€œCOVID-19 fear and volatility index movements: empirical insights from ASEAN stock marketsโ€, Environmental Sciences ad Pollution Research, Springer 2021, vol. 28, pp.67167โ€“67184. [8] M Balcilar, M Bonato, R Demirer, R Gupta, โ€œGeopolitical risks and stock market dynamics of the BRICSโ€, Economic Systems, Elsevier 2018, vol.42, no.2, pp. 295-306. [9] D. Shah, H. Isah and F. Zulkernine, "Predicting the Effects of News Sentiments on the Stock Market," 2018 IEEE International Conference on Big Data (Big Data), Seattle, WA, USA, 2018, pp. 4705-4708. [10] M. S. Hegde, G. Krishna and R. Srinath, "An Ensemble Stock Predictor and Recommender System," 2018 International Conference on Advances in Computing, Communications and Informatics (ICACCI), Bangalore, India, 2018, pp. 1981-1985. [11] Y Cui, Y Jiang, H Gu, โ€œNovel Sentiment Analysis from Twitter for Stock Change Predictionโ€, International Conference on Data Mining and Big Data (DMBD), Springer 2022, pp 160โ€“172. [12] MM Kumbure, C Lohrmann, P Luukka, โ€œMachine learning techniques and data for stock market forecasting: A literature reviewโ€, Expert Systems with Applications, Elsevier 2022, vol. 197, 116659. [13] X Li, P Wu, โ€œStock price prediction incorporating market style clusteringโ€, Cognitive Computation, Springer 2022, vol. 14, pp.149โ€“166. [14] G. Li, A. Zhang, Q. Zhang, D. Wu and C. Zhan, "Pearson Correlation Coefficient-Based Performance Enhancement of Broad Learning System for Stock Price Prediction," in IEEE Transactions on Circuits and Systems II: Express Briefs, 2022, vol. 69, no. 5, pp. 2413-2417. [15] G. Duan, M. Lin, H. Wang and Z. Xu, "Deep Neural Networks for Stock Price Prediction," 2022 14th International Conference on Computer Research and Development (ICCRD), Shenzhen, China, 2022, pp. 65-68. [16] R. Ren, D. D. Wu and T. Liu, "Forecasting Stock Market Movement Direction Using Sentiment Analysis and Support Vector Machine," in IEEE Systems Journal, vol. 13, no. 1, pp. 760-770. Communications on Applied Nonlinear Analysis ISSN: 1074-133X Vol 32 No. 8s (2025) 492 https://internationalpubls.com [17] S. Singh, T. K. Madan, J. Kumar and A. K. Singh, "Stock Market Forecasting using Machine Learning: Today and Tomorrow," 2019 2nd International Conference on Intelligent Computing, Instrumentation and Control Technologies (ICICICT), Kannur, India, 2019, pp. 738-745. [18] Gers F, Eck D, Schmidhuber J.(2020) Applying LSTM to time series predictable through time-window approaches, Neural Nets WIRN Vietri-01. Perspectives in Neural Computing. Springer, 193-200. [19] Gu Q, Chang Y, Xiong N, Chen. (2021), Forecasting Nickel futures price based on the empirical wavelet transform and gradient boosting decision trees, Applied Soft Computing, Elsevier, 109, 107472. [20] S Kim, S Ku, W Chang, JW Song, โ€œPredicting the Direction of US Stock Prices Using Effective Transfer Entropy and Machine Learning Techniquesโ€, IEEE Access 2020, Vol-8, pp: 111660 โ€“ 111682. [21] X Li, P Wu, W Wang, โ€œIncorporating stock prices and news sentiments for stock market prediction: A case of Hong Kongโ€, Information Processing & Management, Elsevier 2020. Volume 57, Issue 5, pp: 1-19. [22] K. A. Althelaya, S. A. Mohammed and E. -S. M. El-Alfy, "Combining Deep Learning and Multiresolution Analysis for Stock Market Forecasting," in IEEE Access, vol. 9, pp. 13099-13111 [23] R Gao, X Zhang, H Zhang, Q Zhao, Y Wang, โ€œForecasting the overnight return direction of stock market index combining global market indices: A multiple-branch deep learning approachโ€, Expert Systems with Applications, Elsevier 2022, vol.194, 116506. [24] A Subakkar, S Graceline Jasmine, L Jani Anbarasi, J Ganesh, CM Yuktha, โ€œAn Analysis on Tesla's Stock Price Forecasting Using ARIMA Modelโ€, Proceedings of the International Conference on Cognitive and Intelligent Computing, Springer, 2023, pp 83โ€“89. [25] B Gรผlmez, โ€œStock price prediction with optimized deep LSTM network with artificial rabbits optimization algorithmโ€, Expert System with Applications, Elsevier, 2023, vol.29. 120346. [26] P Ray, B Ganguli, A Chakrabarti, โ€œMultivariate Bayesian Time-Series Model with Multi-temporal Convolution Network for Forecasting Stock Market During COVID-19 Pandemicโ€, International Journal of Computational Intelligence Systems, Springer 2024, vol.17, no.170, pp.2-14. [27] Z Zhan, SK Kim, โ€œVersatile time-window sliding machine learning techniques for stock market forecastingโ€, Artificial Intelligence Review, Springer 2024, vol. 57, no.209, pp.1-20.