IDEAS home Printed from https://ideas.repec.org/a/gam/jjrfmx/v14y2021i5p198-d546254.html
   My bibliography  Save this article

Predicting Gold and Silver Price Direction Using Tree-Based Classifiers

Author

Listed:
  • Perry Sadorsky

    (Schulich School of Business, York University, Toronto, ON M3J 1P3, Canada)

Abstract

Gold is often used by investors as a hedge against inflation or adverse economic times. Consequently, it is important for investors to have accurate forecasts of gold prices. This paper uses several machine learning tree-based classifiers (bagging, stochastic gradient boosting, random forests) to predict the price direction of gold and silver exchange traded funds. Decision tree bagging, stochastic gradient boosting, and random forests predictions of gold and silver price direction are much more accurate than those obtained from logit models. For a 20-day forecast horizon, tree bagging, stochastic gradient boosting, and random forests produce accuracy rates of between 85% and 90% while logit models produce accuracy rates of between 55% and 60%. Stochastic gradient boosting accuracy is a few percentage points less than that of random forests for forecast horizons over 10 days. For those looking to forecast the direction of gold and silver prices, tree bagging and random forests offer an attractive combination of accuracy and ease of estimation. For each of gold and silver, a portfolio based on the random forests price direction forecasts outperformed a buy and hold portfolio.

Suggested Citation

  • Perry Sadorsky, 2021. "Predicting Gold and Silver Price Direction Using Tree-Based Classifiers," JRFM, MDPI, vol. 14(5), pages 1-21, April.
  • Handle: RePEc:gam:jjrfmx:v:14:y:2021:i:5:p:198-:d:546254
    as

    Download full text from publisher

    File URL: https://www.mdpi.com/1911-8074/14/5/198/pdf
    Download Restriction: no

    File URL: https://www.mdpi.com/1911-8074/14/5/198/
    Download Restriction: no
    ---><---

    References listed on IDEAS

    as
    1. Blose, Laurence E., 2010. "Gold prices, cost of carry, and expected inflation," Journal of Economics and Business, Elsevier, vol. 62(1), pages 35-47, January.
    2. Pönkä, Harri, 2016. "Real oil prices and the international sign predictability of stock returns," Finance Research Letters, Elsevier, vol. 17(C), pages 79-87.
    3. Reboredo, Juan C., 2013. "Is gold a safe haven or a hedge for the US dollar? Implications for risk management," Journal of Banking & Finance, Elsevier, vol. 37(8), pages 2665-2676.
    4. Bergmeir, Christoph & Hyndman, Rob J. & Koo, Bonsoo, 2018. "A note on the validity of cross-validation for evaluating autoregressive time series prediction," Computational Statistics & Data Analysis, Elsevier, vol. 120(C), pages 70-83.
    5. Aye, Goodness & Gupta, Rangan & Hammoudeh, Shawkat & Kim, Won Joong, 2015. "Forecasting the price of gold using dynamic model averaging," International Review of Financial Analysis, Elsevier, vol. 41(C), pages 257-266.
    6. Zhenlong Jiang & Ran Ji & Kuo-Chu Chang, 2020. "A Machine Learning Integrated Portfolio Rebalance Framework with Risk-Aversion Adjustment," JRFM, MDPI, vol. 13(7), pages 1-20, July.
    7. Baur, Dirk G. & McDermott, Thomas K., 2010. "Is gold a safe haven? International evidence," Journal of Banking & Finance, Elsevier, vol. 34(8), pages 1886-1898, August.
    8. Bekiros, Stelios & Boubaker, Sabri & Nguyen, Duc Khuong & Uddin, Gazi Salah, 2017. "Black swan events and safe havens: The role of gold in globally integrated emerging markets," Journal of International Money and Finance, Elsevier, vol. 73(PB), pages 317-334.
    9. Dimitrios Vezeris & Ioannis Karkanis & Themistoklis Kyrgos, 2019. "AdTurtle: An Advanced Turtle Trading System," JRFM, MDPI, vol. 12(2), pages 1-52, June.
    10. Dirk G. Baur & Brian M. Lucey, 2010. "Is Gold a Hedge or a Safe Haven? An Analysis of Stocks, Bonds and Gold," The Financial Review, Eastern Finance Association, vol. 45(2), pages 217-229, May.
    11. Wang, Yudong & Liu, Li & Wu, Chongfeng, 2020. "Forecasting commodity prices out-of-sample: Can technical indicators help?," International Journal of Forecasting, Elsevier, vol. 36(2), pages 666-683.
    12. Christian Pierdzioch & Marian Risse & Sebastian Rohloff, 2015. "Forecasting gold-price fluctuations: a real-time boosting approach," Applied Economics Letters, Taylor & Francis Journals, vol. 22(1), pages 46-50, January.
    13. Libo Yin & Qingyuan Yang & Zhi Su, 2017. "Predictability of structural co-movement in commodity prices: the role of technical indicators," Quantitative Finance, Taylor & Francis Journals, vol. 17(5), pages 795-812, May.
    14. Basak, Suryoday & Kar, Saibal & Saha, Snehanshu & Khaidem, Luckyson & Dey, Sudeepa Roy, 2019. "Predicting the direction of stock market prices using tree-based classifiers," The North American Journal of Economics and Finance, Elsevier, vol. 47(C), pages 552-567.
    15. Christopher J. Neely & David E. Rapach & Jun Tu & Guofu Zhou, 2014. "Forecasting the Equity Risk Premium: The Role of Technical Indicators," Management Science, INFORMS, vol. 60(7), pages 1772-1791, July.
    16. Parisi, Antonino & Parisi, Franco & Díaz, David, 2008. "Forecasting gold price changes: Rolling and recursive neural network models," Journal of Multinational Financial Management, Elsevier, vol. 18(5), pages 477-487, December.
    17. Hossein Hassani & Emmanuel Sirimal Silva & Rangan Gupta & Mawuli K. Segnon, 2015. "Forecasting the price of gold," Applied Economics, Taylor & Francis Journals, vol. 47(39), pages 4141-4152, August.
    18. Junttila, Juha & Pesonen, Juho & Raatikainen, Juhani, 2018. "Commodity market based hedging against stock market risk in times of financial crisis: The case of crude oil and gold," Journal of International Financial Markets, Institutions and Money, Elsevier, vol. 56(C), pages 255-280.
    19. Abdolreza Yazdani-Chamzini & Siamak Haji Yakhchali & Diana Volungevičienė & Edmundas Kazimieras Zavadskas, 2012. "Forecasting gold price changes by using adaptive network fuzzy inference system," Journal of Business Economics and Management, Taylor & Francis Journals, vol. 13(5), pages 994-1010, April.
    20. Nelson Areal & Benilde Oliveira & Raquel Sampaio, 2015. "When times get tough, gold is golden," The European Journal of Finance, Taylor & Francis Journals, vol. 21(6), pages 507-526, April.
    21. Yoshiyuki Suimon & Hiroki Sakaji & Kiyoshi Izumi & Hiroyasu Matsushima, 2020. "Autoencoder-Based Three-Factor Model for the Yield Curve of Japanese Government Bonds and a Trading Strategy," JRFM, MDPI, vol. 13(4), pages 1-21, April.
    22. Ciner, Cetin & Gurdgiev, Constantin & Lucey, Brian M., 2013. "Hedges and safe havens: An examination of stocks, bonds, gold, oil and exchange rates," International Review of Financial Analysis, Elsevier, vol. 29(C), pages 202-211.
    23. Eun-chong Kim & Han-wook Jeong & Nak-young Lee, 2019. "Global Asset Allocation Strategy Using a Hidden Markov Model," JRFM, MDPI, vol. 12(4), pages 1-15, November.
    24. Beckmann, Joscha & Berger, Theo & Czudaj, Robert, 2015. "Does gold act as a hedge or a safe haven for stocks? A smooth transition approach," Economic Modelling, Elsevier, vol. 48(C), pages 16-24.
    25. Nico Zengeler & Uwe Handmann, 2020. "Contracts for Difference: A Reinforcement Learning Approach," JRFM, MDPI, vol. 13(4), pages 1-12, April.
    26. Iqbal, Javed, 2017. "Does gold hedge stock market, inflation and exchange rate risks? An econometric investigation," International Review of Economics & Finance, Elsevier, vol. 48(C), pages 1-17.
    27. Risse, Marian, 2019. "Combining wavelet decomposition with machine learning to forecast gold returns," International Journal of Forecasting, Elsevier, vol. 35(2), pages 601-615.
    28. Hoang, Thi Hong Van & Lahiani, Amine & Heller, David, 2016. "Is gold a hedge against inflation? New evidence from a nonlinear ARDL approach," Economic Modelling, Elsevier, vol. 54(C), pages 54-66.
    29. Vasilios Plakandaras & Periklis Gogas & Theophilos Papadimitriou, 2021. "Gold Against the Machine," Computational Economics, Springer;Society for Computational Economics, vol. 57(1), pages 5-28, January.
    30. Kausik Gangopadhyay & Abhishek Jangir & Rudra Sensarma, 2014. "Forecasting the price of gold: An error correction approach," Working papers 155, Indian Institute of Management Kozhikode.
    31. Nyberg, Henri & Pönkä, Harri, 2016. "International sign predictability of stock returns: The role of the United States," Economic Modelling, Elsevier, vol. 58(C), pages 323-338.
    32. Lohrmann, Christoph & Luukka, Pasi, 2019. "Classification of intraday S&P500 returns with a Random Forest," International Journal of Forecasting, Elsevier, vol. 35(1), pages 390-407.
    33. Baur, Dirk G. & McDermott, Thomas K.J., 2016. "Why is gold a safe haven?," Journal of Behavioral and Experimental Finance, Elsevier, vol. 10(C), pages 63-71.
    34. O'Connor, Fergal A. & Lucey, Brian M. & Batten, Jonathan A. & Baur, Dirk G., 2015. "The financial economics of gold — A survey," International Review of Financial Analysis, Elsevier, vol. 41(C), pages 186-205.
    35. Hood, Matthew & Malik, Farooq, 2013. "Is gold the best hedge and a safe haven under changing stock market volatility?," Review of Financial Economics, Elsevier, vol. 22(2), pages 47-52.
    36. Leung, Mark T. & Daouk, Hazem & Chen, An-Sing, 2000. "Forecasting stock indices: a comparison of classification and level estimation models," International Journal of Forecasting, Elsevier, vol. 16(2), pages 173-190.
    37. Perry Sadorsky, 2021. "A Random Forests Approach to Predicting Clean Energy Stock Prices," JRFM, MDPI, vol. 14(2), pages 1-20, January.
    38. Nyberg, Henri, 2011. "Forecasting the direction of the US stock market with dynamic binary probit models," International Journal of Forecasting, Elsevier, vol. 27(2), pages 561-578.
    39. Nyberg, Henri, 2011. "Forecasting the direction of the US stock market with dynamic binary probit models," International Journal of Forecasting, Elsevier, vol. 27(2), pages 561-578, April.
    40. Yin, Libo & Yang, Qingyuan, 2016. "Predicting the oil prices: Do technical indicators help?," Energy Economics, Elsevier, vol. 56(C), pages 338-350.
    41. Thi Hong Van Hoang & Amine Lahiani & David Heller, 2016. "Is gold a hedge against inflation? New evidence from a nonlinear ARDL approach," Post-Print hal-02012307, HAL.
    42. Thomas E. Koker & Dimitrios Koutmos, 2020. "Cryptocurrency Trading Using Machine Learning," JRFM, MDPI, vol. 13(8), pages 1-7, August.
    43. Marco Tronzano, 2021. "Financial Crises, Macroeconomic Variables, and Long-Run Risk: An Econometric Analysis of Stock Returns Correlations (2000 to 2019)," JRFM, MDPI, vol. 14(3), pages 1-25, March.
    44. Alameer, Zakaria & Elaziz, Mohamed Abd & Ewees, Ahmed A. & Ye, Haiwang & Jianhua, Zhang, 2019. "Forecasting gold price fluctuations using improved multilayer perceptron neural network and whale optimization algorithm," Resources Policy, Elsevier, vol. 61(C), pages 250-260.
    45. Shafiee, Shahriar & Topal, Erkan, 2010. "An overview of global gold market and gold price forecasting," Resources Policy, Elsevier, vol. 35(3), pages 178-189, September.
    46. Christian Pierdzioch & Marian Risse, 2020. "Forecasting precious metal returns with multivariate random forests," Empirical Economics, Springer, vol. 58(3), pages 1167-1184, March.
    Full references (including those not matched with items on IDEAS)

    Citations

    Citations are extracted by the CitEc Project, subscribe to its RSS feed for this item.
    as


    Cited by:

    1. Sadorsky, Perry, 2022. "Forecasting solar stock prices using tree-based machine learning classification: How important are silver prices?," The North American Journal of Economics and Finance, Elsevier, vol. 61(C).
    2. Syed Abul, Basher & Perry, Sadorsky, 2022. "Forecasting Bitcoin price direction with random forests: How important are interest rates, inflation, and market volatility?," MPRA Paper 113293, University Library of Munich, Germany.

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Syed Abul, Basher & Perry, Sadorsky, 2022. "Forecasting Bitcoin price direction with random forests: How important are interest rates, inflation, and market volatility?," MPRA Paper 113293, University Library of Munich, Germany.
    2. Sadorsky, Perry, 2022. "Forecasting solar stock prices using tree-based machine learning classification: How important are silver prices?," The North American Journal of Economics and Finance, Elsevier, vol. 61(C).
    3. Perry Sadorsky, 2021. "A Random Forests Approach to Predicting Clean Energy Stock Prices," JRFM, MDPI, vol. 14(2), pages 1-20, January.
    4. Dichtl, Hubert, 2020. "Forecasting excess returns of the gold market: Can we learn from stock market predictions?," Journal of Commodity Markets, Elsevier, vol. 19(C).
    5. Talbi, Marwa & Bedoui, Rihab & de Peretti, Christian & Belkacem, Lotfi, 2021. "Is the role of precious metals as precious as they are? A vine copula and BiVaR approaches," Resources Policy, Elsevier, vol. 73(C).
    6. Vasilios Plakandaras & Periklis Gogas & Theophilos Papadimitriou, 2021. "Gold Against the Machine," Computational Economics, Springer;Society for Computational Economics, vol. 57(1), pages 5-28, January.
    7. Han, Liyan & Xu, Yang & Yin, Libo, 2017. "Does investor attention matter? The attention-return relation in gold futures market," Economics Discussion Papers 2017-37, Kiel Institute for the World Economy (IfW Kiel).
    8. Ali, Sajid & Bouri, Elie & Czudaj, Robert Lukas & Shahzad, Syed Jawad Hussain, 2020. "Revisiting the valuable roles of commodities for international stock markets," Resources Policy, Elsevier, vol. 66(C).
    9. Rangan Gupta & Sayar Karmakar & Christian Pierdzioch, 2022. "Safe Havens, Machine Learning, and the Sources of Geopolitical Risk: A Forecasting Analysis Using Over a Century of Data," Working Papers 202201, University of Pretoria, Department of Economics.
    10. Risse, Marian, 2019. "Combining wavelet decomposition with machine learning to forecast gold returns," International Journal of Forecasting, Elsevier, vol. 35(2), pages 601-615.
    11. Mohamed Arbi Madani & Zied Ftiti, 2022. "Is gold a hedge or safe haven against oil and currency market movements? A revisit using multifractal approach," Annals of Operations Research, Springer, vol. 313(1), pages 367-400, June.
    12. Enilov, Martin & Mensi, Walid & Stankov, Petar, 2023. "Does safe haven exist? Tail risks of commodity markets during COVID-19 pandemic," Journal of Commodity Markets, Elsevier, vol. 29(C).
    13. Salisu, Afees A. & Ndako, Umar B. & Oloko, Tirimisiyu F., 2019. "Assessing the inflation hedging of gold and palladium in OECD countries," Resources Policy, Elsevier, vol. 62(C), pages 357-377.
    14. Semeyutin, Artur & Downing, Gareth, 2022. "Co-jumps in the U.S. interest rates and precious metals markets and their implications for investors," International Review of Financial Analysis, Elsevier, vol. 81(C).
    15. Abdelbari El Khamlichi & Thi Hong Van Hoang & Wing‐keung Wong, 2016. "Is Gold Different for Islamic and Conventional Portfolios? A Sectorial Analysis," Post-Print hal-02965765, HAL.
    16. Hoang, Thi-Hong-Van & Zhu, Zhenzhen & El Khamlichi, Abdelbari & Wong, Wing-Keung, 2019. "Does the Shari’ah screening impact the gold-stock nexus? A sectorial analysis," Resources Policy, Elsevier, vol. 61(C), pages 617-626.
    17. Joscha Beckmann & Theo Berger & Robert Czudaj, 2019. "Gold price dynamics and the role of uncertainty," Quantitative Finance, Taylor & Francis Journals, vol. 19(4), pages 663-681, April.
    18. Mokni, Khaled & Youssef, Manel & Ajmi, Ahdi Noomen, 2022. "COVID-19 pandemic and economic policy uncertainty: The first test on the hedging and safe haven properties of cryptocurrencies," Research in International Business and Finance, Elsevier, vol. 60(C).
    19. Syed Jawad Hussain Shahzad & Naveed Raza & David Roubaud & Jose Arreola Hernandez & Stelios Bekiros, 2019. "Gold as Safe Haven for G-7 Stocks and Bonds: A Revisit," Journal of Quantitative Economics, Springer;The Indian Econometric Society (TIES), vol. 17(4), pages 885-912, December.
    20. Andrew Urquhart, 2017. "How predictable are precious metal returns?," The European Journal of Finance, Taylor & Francis Journals, vol. 23(14), pages 1390-1413, November.

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:gam:jjrfmx:v:14:y:2021:i:5:p:198-:d:546254. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: MDPI Indexing Manager (email available below). General contact details of provider: https://www.mdpi.com .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.