An Ensemble Deep Learning Approach for Forecasting Top 20 TSX-Listed Equities
Keywords:
Toronto Stock Exchange · ensemble deep learning · LSTM · stock price forecasting · time-series analysis · transfer learning · Yahoo Finance API · residual diagnostics · homoscedasticityAbstract
Forecasting equity prices on the Toronto Stock Exchange (TSX) is a genuinely difficult problem, and not just for the usual reasons. The Canadian market sits at the crossroads of two forces that rarely move together: global commodity cycles, which drive the resource sector that makes up a large share of the index, and tightly regulated domestic banking, which provides the steady counterweight. When oil prices fall sharply, the banks often hold firm; when interest rates spike, the energy producers can still benefit from high commodity prices. This push-and-pull makes the TSX a more complex forecasting environment than markets that are dominated by a single sector or a handful of mega-cap technology companies.
This study takes that complexity head-on by building and rigorously evaluating an ensemble deep learning pipeline against ten years of daily price data — January 2015 through January 2025 — for twenty of the TSX's most prominent listed equities. The tickers were chosen to span four distinct sectors: banking and financial services, energy and infrastructure, technology and precious metals, and diversified industrials. This breadth is deliberate; a model that only works within one industry has limited practical value.
Adjusted closing prices were pulled from the Yahoo Finance API, cleaned for gaps and corporate actions, transformed into log-returns to achieve approximate stationarity, and enriched with rolling statistical features before any modelling began. The resulting architecture combines two LSTM sub-networks — each trained independently on a 60-day sliding window of return features — with weights initialised from a checkpoint pretrained on approximately 500 S&P 500 constituent series. Predictions from the two sub-networks are aggregated through a compact dense regression head to produce a single one-step-ahead price forecast.
The proposed model outperforms the Li-Shi Hybrid Preprocessing Neural Network model [3] on all three evaluation metrics: RMSE falls to 0.02195 (a 4.6% reduction), MAE to 0.01594 (11.4% reduction), and MAPE to 0.38% (15.6% reduction). More importantly, residual diagnostics confirm that forecast errors are unbiased and homoscedastic across the full range of predicted values — a property that matters enormously if these forecasts are to be used in a real risk management context, where reliable confidence intervals are not optional. The full pipeline is open-source and fully reproducible from a standard Python environment.
References
1. Fischer T, Krauss C (2018) Deep learning with long short-term memory networks for financial market predictions. Eur J Oper Res 270(2):654–669. https://doi.org/10.1016/j.ejor.2017.11.054
2. Sezer OB, Gudelek MU, Ozbayoglu AM (2020) Financial time series forecasting with deep learning: a systematic literature review (2005–2019). Appl Soft Comput 90:106181. https://doi.org/10.1016/j.asoc.2020.106181
3. Li J-L, Shi W-K (2024) Hybrid preprocessing for neural network-based stock price prediction. Heliyon 10:e40819. https://doi.org/10.1016/j.heliyon.2024.e40819
4. Box GEP, Jenkins GM, Reinsel GC, Ljung GM (2015) Time series analysis: forecasting and control, 5th edn. Wiley, Hoboken
5. Hochreiter S, Schmidhuber J (1997) Long short-term memory. Neural Comput 9(8):1735–1780. https://doi.org/10.1162/neco.1997.9.8.1735
6. Bao W, Yue J, Rao Y (2017) A deep learning framework for financial time series using stacked autoencoders and long short-term memory. PLoS ONE 12(7):e0180944. https://doi.org/10.1371/journal.pone.0180944
7. Qian B, Rasheed K (2007) Stock market prediction with multiple classifiers. Appl Intell 26(1):25–33. https://doi.org/10.1007/s10489-006-0001-7
8. Pan SJ, Yang Q (2010) A survey on transfer learning. IEEE Trans Knowl Data Eng 22(10):1345–1359. https://doi.org/10.1109/TKDE.2009.191
9. Elton EJ, Gruber MJ, Brown SJ, Goetzmann WN (2014) Modern portfolio theory and investment analysis, 9th edn. Wiley, Hoboken
10. Vaswani A, Shazeer N, Parmar N, Uszkoreit J, Jones L, Gomez AN, Kaiser Ł, Polosukhin I (2017) Attention is all you need. Adv Neural Inf Process Syst 30:5998–6008
11. TMX Group (2024) TSX market statistics and sector composition. TMX Group Limited. https://www.tmx.com
12. Aroussi R (2023) yfinance: download market data from Yahoo! Finance’s API (Version 0.2) [Computer software]. Python Package Index. https://pypi.org/project/yfinance/
13. Gers FA, Schmidhuber J, Cummins F (2000) Learning to forget: continual prediction with LSTM. Neural Comput 12(10):2451–2471. https://doi.org/10.1162/089976600300015015
14. Nelson DMQ, Pereira ACM, de Oliveira RA (2017) Stock market’s price movement prediction with LSTM neural networks. In: Proc IJCNN 2017, pp 1419–1426. https://doi.org/10.1109/IJCNN.2017.7966019
15. Ding X, Zhang Y, Liu T, Duan J (2015) Deep learning for event-driven stock prediction. In: Proc IJCAI 2015, pp 2327–2333
16. Zhang GP (2003) Time series forecasting using a hybrid ARIMA and neural network model. Neurocomputing 50:159–175. https://doi.org/10.1016/S0925-2312(01)00702-0
17. Selvin S, Vinayakumar R, Gopalakrishnan EA, Menon VK, Soman KP (2017) Stock price prediction using LSTM, RNN and CNN-sliding window model. In: Proc ICACCI 2017, pp 1643–1647. https://doi.org/10.1109/ICACCI.2017.8126078
18. Gao T, Chai Y (2018) Improving stock closing price prediction using recurrent neural network and technical indicators. Neural Comput 30(10):2833–2854. https://doi.org/10.1162/neco_a_01124
19. Moghar A, Hamiche M (2020) Stock market prediction using LSTM recurrent neural network. Procedia Comput Sci 170:1168–1173. https://doi.org/10.1016/j.procs.2020.03.049
20. Kim HY, Won CH (2018) Forecasting the volatility of stock price index: a hybrid model integrating LSTM with multiple GARCH-type models. Expert Syst Appl 103:25–37. https://doi.org/10.1016/j.eswa.2018.03.002
Downloads
Published
Data Availability Statement
The dataset and code used to generate the findings of this study are available from the corresponding author upon reasonable request.
Issue
Section
License
Copyright (c) 2026 Journal of Intelligent Machines and Engineering

This work is licensed under a Creative Commons Attribution 4.0 International License.