Directly Learning Stock Trading Strategies Through Profit Guided Loss Functions
Devroop Kar, Zimeng Lyu, Sheeraja Rajakrishnan, Alex Ororbia, Hao Zhang, Travis Desell, Daniel Krutz · 2025
Read Directly Learning Stock Trading Strategies Through Profit Guided Loss Functions by Devroop Kar, Zimeng Lyu, Sheeraja Rajakrishnan, Alex Ororbia, Hao Zhang, Travis Desell, Daniel Krutz (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2507-19639.txt.
Introduction
Devroop Kar and co-authors teach trading rules straight from profit, in a 2025 paper. Most stock models learn to guess prices, then bolt trading rules on top. This team instead wrote four new training scores that reward gains and punish losses on buys and shorts. Any neural net can train on these scores and learn the trading act itself.
They trained time-based models on 50 large United States stocks. Across three test years, their best pairing earned about half again the starting cash each year. Two strong game-style methods did worse, topping out near two fifths in their best years. A plain buy-and-hold plan lagged further behind. The authors post their code for others to check, while noting past gains do not promise future ones.
Catalog record
| CREATOR | Devroop Kar, Zimeng Lyu, Sheeraja Rajakrishnan, Alex Ororbia, Hao Zhang, Travis Desell, Daniel Krutz |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 40 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2507-19639
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Directly Learning Stock Trading Strategies Through Profit Guided Loss Functions Devroop Kar, Zimeng Lyu, Sheeraja Rajakrishnan, Alex Ororbia, Hao Zhang, Travis Desell, Daniel Krutz Abstract Stock trading has always been a challenging task due to the highly volatile nature of the stock market. Making sound trading decisions to generate profit is particularly difficult under such conditions. To address this, we propose four novel loss functions to drive decision-making for a portfolio of stocks. These functions account for the potential profits or losses based with respect to buying or shorting respective stocks, enabling potentially any artificial neural network to directly learn an effective trading strategy. Despite the high volatility in stock market fluctuations over time, training time-series models such as transformers on these loss functions resulted in trading strategies that generated significant profits on a portfolio of 50 50 different S&P 500 500 company stocks as compared to a benchmark reinforcment learning techniques and a baseline buy and hold method. As an example, using 2021, 2022 and 2023 as three test periods, the Crossformer model adapted with our best loss function was most consistent, resulting in returns of 51.42 % 51.42\% , 51.04 % 51.04\% and 48.62 % 48.62\% respectively. In comparison, the best performing state-of-the-art reinforcement learning methods, PPO and DDPG, only delivered maximum profits of around 41 41 %, 2.81 % 2.81\% and 41.58 % 41.58\% for the same periods. The code is available at https://anonymous.4open.science/r/bandit-stock-trading-58C8/README.md . 1 Introduction Rapid advancements in artificial intelligence (AI) have revolutionized numerous industries, including finance. In stock forecasting and portfolio management, AI techniques have shown potential in enhancing the quality of decision-making, mitigating risks, and optimizing returns. The increasing availability of large-scale financial data, combined with sophisticated computational tools, has provided an opportunity to leverage AI to navigate the complexities of financial markets. Stock forecasting, the process of predicting future price movements or trends, is a cornerstone of investment strategy. Traditional methods, such as fundamental and technical analysis, often rely on human judgment and linear modeling, which can struggle to account for the dynamic and nonlinear nature of financial markets. AI-driven approaches such as machine learning (ML) [ 20 ] , deep learning (DL) [ 37 ] , and natural language processing (NLP) [ 14 ] have the ability to analyze vast amounts of structured and unstructured data. These methods can uncover hidden patterns and relationships, offering a great edge in prediction accuracy. Portfolio management, another critical aspect of investment strategy, involves the selection and allocation of assets to balance risk and reward according to an investor’s objectives. Conventional portfolio optimization methods [ 9 ] , including statistical models such as autoregressive integrated moving average (ARIMA) and vector auto-regression (VAR) often assume static market conditions and require simplifying assumptions that limit their applicability. AI-based portfolio management systems overcome these limitations by dynamically adapting to changing market conditions, integrating real-time data, and employing techniques such as reinforcement learning (RL) and optimization algorithms to construct robust portfolios. New architectures and techniques are being introduced daily to predict such stock fluctuation, or on a broad scale, for time-series forecasting (TSF). Rather than designing different architectures, we introduce four variations of a loss function that would guide an artificial neural network (ANN) to learn a portfolio management strategy. This is in contrast to RL methods which seek to uncover a policy/strategy or other decision-making strategies, e.g., heuristics or bandits, which operate off time-series forecasts or historical data. These loss functions allow ANNs to directly learn trading strategies specifying which stocks to buy or to short and by how much or if assuming a “hold” position would be more beneficial. With this in mind, we investigate the following research questions: RQ1. Can a directly learned strategy allow any deep learning architecture for time-series forecasting to learn inter-stock patterns and maximize profits? - We find that utilizing and applying a custom loss function for training transformer-based models provides better overall strategies for generating profits. RQ2. How would the performance of such a strategy compare across different TSF models as well as RL models? - We find that, while the ability of an artificial neural network to identify relations across company stocks is a factor, such a loss-function driven approach yields better performance in generating profit as compared to other methods. 2 Related Work A variety of methods have been applied for time-series forecasting of stock data. Some of the most well-known include traditional statistical models, such as the auto-regressive integrated moving average (ARIMA) [ 33 ] and general auto-regressive conditional heteroskedasticity (GARCH) [ 2 ] . These approaches are limited given that they often fail to recognize the intricate, non-linear dynamics present in stock data. Moreover, these models rely on certain assumptions, such as data stationarity, and struggle with high levels of volatility [ 20 ] . AI and machine learning techniques have been adopted to address these limitations due to their ability to process large data volumes and uncover complex patterns [ 21 ] . Recurrent neural network (RNN) architectures have been used extensively for stock price prediction. Kamijo et al. and Kiani et al. [ 15 ] [ 17 ] have showcased their efficacy for this task. LSTM-RNN models have been extensively employed for predicting stock prices and market trends, as shown in studies by Smith et al. , Gao et al. , and Ghosh et al. [ 36 , 7 , 8 , 57 , 50 , 31 , 3 , 10 , 27 ] . Zhang et al. [ 5 ] investigated the application of long short-term memory (LSTM) networks for predicting stock prices, demonstrating their superior performance compared to traditional time-series models, such as ARIMA. Beyond single architectures, Zhang et al. demonstrated the efficacy of integrating deep belief networks (DBNs) with LSTMs for stock price movement prediction [ 55 ] . Hybrid approaches involving RNNs and convolutional neural networks (CNNs) have also been explored; using a hybrid RNN-CNN architecture, Zhang et al. and Yang et al. [ 53 , 49 ] were able to improve prediction accuracy. These methods combine the temporal modeling strengths of RNNs with the feature extraction capabilities of CNNs. Kong et al. [ 19 ] proposed P-sLSTM, which utilized patches to divide the time series into manageable portions – this allowed the underlying sLSTM [ 1 ] to learn short-term dependencies and then combined them to extract global dependencies. Transformers were originally developed for neural machine translation [ 40 ] tasks. However, since then, they have been adapted for multivariate time-series forecasting and have shown great potential in capturing temporal patterns and cross-dimensional relationships [ 52 , 46 ] . Wu et al. [ 42 ] introduced the Autoformer with a novel auto-correlation mechanism in place of the usual transformer self-attention mechanism. The Crossformer, from Zhang et al. [ 56 ] , utilized dimension-segment-wise (DSW) embeddings and a two-stage attention (TSA) layer to model both inter-temporal and inter-dimension patterns effectively. Similarly, DeformTime introduced deformable attention blocks (DABs) to enhance pattern recognition across exogenous variables [ 35 ] at different temporal granularities. DLinear [ 51 ] uses a fully-connected layer i.e. MLP, along the temporal dimension with seasonal-trend decomposition to for future estimations. TimesNet [ 43 ] uses convolutions to discover