IDEAS home Printed from https://ideas.repec.org/p/arx/papers/2412.18405.html

Generalized Mean Absolute Directional Loss for Machine Learning Trading Models

Author

Listed:
  • Jakub Micha'nk'ow
  • Pawe{l} Sakowski
  • Robert 'Slepaczuk

Abstract

The article presents and evaluates a custom loss function designed specifically for machine learning models used in algorithmic trading. Regardless of the selected asset class and the level of model complexity, the proposed Generalized Mean Absolute Directional Loss (GMADL) function produces superior results and has better numerical properties during optimization than classic regression and classification based loss functions. Better results correspond to higher risk-weighted returns based on buy and sell signals derived from forecasts generated by models trained using GMADL. In practice, GMADL improves model evaluation by aligning the learning objective with trading performance rather than generic error minimization or simple directional accuracy. Through additional parameterization, GMADL provides a flexible mechanism for adjusting the loss's sensitivity to different return magnitudes, which affects model evaluation consistency across various market regimes. This improves the selection of model configurations that are more consistent with performance-based criteria. Moreover, the implementation uses robust machine learning tools, including frameworks for hyperparameter tuning, architecture testing, and walk-forward optimization, to provide robust and scalable model evaluation across real-world financial data from different asset classes.

Suggested Citation

  • Jakub Micha'nk'ow & Pawe{l} Sakowski & Robert 'Slepaczuk, 2024. "Generalized Mean Absolute Directional Loss for Machine Learning Trading Models," Papers 2412.18405, arXiv.org, revised Aug 2026.
  • Handle: RePEc:arx:papers:2412.18405
    as

    Download full text from publisher

    File URL: https://arxiv.org/pdf/2412.18405
    File Function: Latest version
    Download Restriction: no
    ---><---

    References listed on IDEAS

    as
    1. Svetlana Borovkova & Ioannis Tsiamas, 2019. "An ensemble of LSTM neural networks for high‐frequency stock market classification," Journal of Forecasting, John Wiley & Sons, Ltd., vol. 38(6), pages 600-619, September.
    2. Minjae Park & Mi Lim Lee & Jinpyo Lee, 2019. "Predicting Stock Market Indices Using Classification Tools," Asian Economic and Financial Review, Asian Economic and Social Society, vol. 9(2), pages 243-256, February.
    3. Gaurang Sonkavde & Deepak Sudhakar Dharrao & Anupkumar M. Bongale & Sarika T. Deokate & Deepak Doreswamy & Subraya Krishna Bhat, 2023. "Forecasting Stock Market Prices Using Machine Learning and Deep Learning Models: A Systematic Review, Performance Analysis and Discussion of Implications," IJFS, MDPI, vol. 11(3), pages 1-22, July.
    4. Park, Minjae & Lee, Mi Lim & Lee, Jinpyo, 2019. "Predicting Stock Market Indices Using Classification Tools," Asian Economic and Financial Review, Asian Economic and Social Society, vol. 9(2), pages 243-256.
    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. Andrei Bysik & Robert 'Slepaczuk, 2026. "Machine Learning-Based Bitcoin Trading Under Transaction Costs: Evidence From Walk-Forward Forecasting," Papers 2606.00060, arXiv.org.

    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. Ergenç Cansu & Aktaş Rafet, 2025. "A Supervised Machine Learning in Financial Forecasting: Identifying Effective Models for the BIST100 Index," Review of Economic Perspectives, Paradigm, vol. 25(1), pages 66-90.
    2. Xu, Hailun & Yuan, Xianghui & Jin, Liwei & Long, Jun & Xu, Gen, 2026. "Ascertaining price formation in financial markets with machine learning: Evidence from Chinese stocks," Pacific-Basin Finance Journal, Elsevier, vol. 96(C).
    3. Gaoshan Wang & Guangjin Yu & Xiaohong Shen, 2020. "The Effect of Online Investor Sentiment on Stock Movements: An LSTM Approach," Complexity, Hindawi, vol. 2020, pages 1-11, December.
    4. Zeng, Qing & Lu, Xinjie & Xu, Jin & Lin, Yu, 2024. "Macro-Driven Stock Market Volatility Prediction: Insights from a New Hybrid Machine Learning Approach," International Review of Financial Analysis, Elsevier, vol. 96(PB).
    5. Mohammad Zoynul Abedin & Mahmudul Hasan Moon & M. Kabir Hassan & Petr Hajek, 2025. "Deep learning-based exchange rate prediction during the COVID-19 pandemic," Annals of Operations Research, Springer, vol. 345(2), pages 1335-1386, February.
    6. Bernardino, Wilton & Falcão, Rodrigo & Jr., João & Ospina, Raydonal & de Souza, Filipe Costa & Correia, José Jonas Alves, 2025. "A study of asset and liability management applied to Brazilian pension funds," European Journal of Operational Research, Elsevier, vol. 322(3), pages 1059-1076.
    7. Yuanrong Wang & Yinsen Miao & Alexander CY Wong & Nikita P Granger & Christian Michler, 2023. "Domain-adapted Learning and Interpretability: DRL for Gas Trading," Papers 2301.08359, arXiv.org, revised Sep 2023.
    8. Flori, Andrea & Regoli, Daniele, 2021. "Revealing Pairs-trading opportunities with long short-term memory networks," European Journal of Operational Research, Elsevier, vol. 295(2), pages 772-791.
    9. Tölö, Eero, 2020. "Predicting systemic financial crises with recurrent neural networks," Journal of Financial Stability, Elsevier, vol. 49(C).
    10. Zhiyuan Pei & Jianqi Yan & Jin Yan & Bailing Yang & Ziyuan Li & Lin Zhang & Xin Liu & Yang Zhang, 2024. "A Stock Price Prediction Approach Based on Time Series Decomposition and Multi-Scale CNN using OHLCT Images," Papers 2410.19291, arXiv.org, revised Oct 2024.
    11. Yonghong Li & Zhixian Li & Yuting Chen & Yayun Wang & Sidong Xian & Zhiqiang Zhao & Linyan Zhou & Ji Li, 2025. "MLBGK: A Novel Feature Fusion Model for Forecasting Stocks Prices," Computational Economics, Springer;Society for Computational Economics, vol. 66(3), pages 2565-2592, September.
    12. Firuz Kamalov & Linda Smail & Ikhlaas Gurrib, 2021. "Stock price forecast with deep learning," Papers 2103.14081, arXiv.org.
    13. Firuz Kamalov, 2019. "Forecasting significant stock price changes using neural networks," Papers 1912.08791, arXiv.org.
    14. Adam Korniejczuk & Robert Ślepaczuk, 2024. "Statistical arbitrage in multi-pair trading strategy based on graph clustering algorithms in US equities market," Working Papers 2024-09, Faculty of Economic Sciences, University of Warsaw.
    15. Siyang Mei & Yuxi Zhang & Xin Liu & Feng Li, 2025. "Presenting an innovative methodology to effectively handle investment risk in financial markets," International Journal of System Assurance Engineering and Management, Springer;The Society for Reliability, Engineering Quality and Operations Management (SREQOM),India, and Division of Operation and Maintenance, Lulea University of Technology, Sweden, vol. 16(10), pages 3390-3408, October.
    16. Flavio Barboza & Geraldo Nunes Silva & José Augusto Fiorucci, 2023. "A review of artificial intelligence quality in forecasting asset prices," Journal of Forecasting, John Wiley & Sons, Ltd., vol. 42(7), pages 1708-1728, November.
    17. MINAMI, Koutaroh, 2025. "Detecting Bubbles by Machine Learning Prediction," Working Paper Series G-1-30, Hitotsubashi University Center for Financial Research.
    18. Gil Cohen, 2022. "Artificial Intelligence in Trading the Financial Markets," International Journal of Economics & Business Administration (IJEBA), International Journal of Economics & Business Administration (IJEBA), vol. 0(1), pages 101-110.
    19. Hussain, Syed Mujahid & Ahmad, Nisar & Ahmed, Sheraz, 2023. "Applications of high-frequency data in finance: A bibliometric literature review," International Review of Financial Analysis, Elsevier, vol. 89(C).
    20. Prashant Pilla & Raji Mekonen, 2025. "Forecasting S&P 500 Using LSTM Models," Papers 2501.17366, arXiv.org.

    More about this item

    Statistics

    Access and download statistics

    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:arx:papers:2412.18405. 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: arXiv administrators (email available below). General contact details of provider: https://arxiv.org/ .

    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.