Source-linked AI summary

Trading Strategy Optimization via Textual Gradient

Chaoqun Yang, Qian Wang, Fengbin Zhu, Xinyu Lin, Bingsheng He, Roger Zimmermann, Tat-Seng Chua

arXiv:2610.03128v1cs.AI

TL;DR

Trading strategies must work beyond historical backtests, yet textual-gradient optimization can forget prior evaluations and aggregate feedback can overlook temporal robustness. TradeGrad combines accumulated experience and multi-scale revisions with a lower-tail objective across historical periods. It achieves the highest in-sample and out-of-sample scores across four settings, with a reported Sharpe-ratio advantage over CSI 300 for its Chinese cross-sectional strategy.

  • Problem

    Strategy design seeks programs that work in future markets, while directly applied textual gradients can be myopic and aggregate backtest feedback can overlook performance differences across periods.

    Source: §1 · p. 1
  • Method

    TradeGrad reuses optimization experience through sampled archived strategies and multi-scale revisions, and uses CPRO to emphasize lower-tail performance across calendar-year windows.

    Source: §1 · p. 2
  • Results

    Across all four settings, TradeGrad achieves the highest in-sample and out-of-sample scores; its Chinese cross-sectional Sharpe ratio is 1.63, about 68% above CSI 300.

    Source: §1 · pp. 2–3
  • Takeaways & Limitations

    Optimization trajectory analysis shows consistent in-sample and out-of-sample improvement for TradeGrad, while compared methods tend to plateau or deteriorate.

    Source: §1 · p. 3

    Optimization accesses only in-sample historical backtests; the out-of-sample period is held out for evaluating generalization.

    Source: §2.2 · p. 3

Abstract

from arXiv · show

Quantitative trading strategy design aims to discover trading programs from historical data that remain effective in future markets, which can be viewed as a black-box program optimization problem. LLM-based textual gradients offer a promising approach by providing explicit optimization directions for iterative strategy refinement. However, directly applying textual gradients faces two challenges: (1) optimization is myopic, underutilizing experience from previous evaluations; and (2) aggregate backtest feedback overlooks temporal robustness, potentially favoring strategies that perform well only in specific market periods. To address these challenges, we propose TradeGrad, an experience-guided textual-gradient framework for robust trading strategy optimization. TradeGrad leverages accumulated optimization experience to estimate textual gradients and employs multi-scale revisions for both strategy exploration and refinement. It further introduces the Cross-Period Robust Objective (CPRO), which emphasizes performance in unfavorable historical periods to promote temporal robustness. Experiments on cross-sectional and time-series strategy design in Chinese A-share and U.S. equity markets show that TradeGrad achieves the best in-sample and out-of-sample performance across all four settings. Notably, its Chinese cross-sectional strategy achieves 27.99% annualized return, 12.19% maximum drawdown, and a Sharpe ratio of 1.63, approximately 68% higher than the CSI 300 benchmark. Further analyses validate the proposed components and show consistent improvements in both in-sample and out-of-sample performance throughout optimization. The code is available at https://github.com/transcend-0/TradeGrad.

1 INTRODUCTION

The introduction frames strategy design as black-box program optimization for future markets and identifies myopic gradients and period-insensitive feedback as challenges. TradeGrad combines experience-guided revisions with cross-period evaluation; experiments report the strongest in-sample and out-of-sample results across four settings.

1 INTRODUCTION

  • Existing LLM-based strategy search relies largely on stochastic mutations, whereas textual gradients diagnose program weaknesses and suggest actionable revision directions.Source: §1 · p. 2
  • Direct textual-gradient optimization can forget earlier successes and failures, while aggregate backtest scores can hide weak periods and favor period-specific improvements.The introduction identifies these as barriers to temporal robustness and generalization across market regimes.Source: §1 · pp. 2–3
  • TradeGrad reuses successful and failed strategy patterns through global optimization memory and sampled archived evaluations, then applies structural exploration or localized refinement.Structural revisions explore alternative trading hypotheses; localized edits refine promising strategies.Source: §1 · pp. 2–3
  • CPRO evaluates strategies across calendar-year windows, combines return, drawdown, and trading-activity measures, and aggregates lower-tail scores to emphasize unfavorable periods.Source: §1 · pp. 2–3
  • TradeGrad achieves the highest in-sample and out-of-sample scores across four Chinese A-share and U.S. equity strategy settings, with favorable risk–return trade-offs.Its Chinese cross-sectional strategy achieves 27.99% annualized return, 12.19% maximum drawdown, and a Sharpe ratio of 1.63, about 68% above CSI 300 in Sharpe ratio.Source: §1 · pp. 2–3
  • TradeGrad improves both in-sample and out-of-sample performance throughout optimization, while compared methods tend to plateau or deteriorate.Source: §1 · p. 3

2 PROBLEM FORMULATION

Automated trading strategy design is framed as black-box optimization over executable programs, with the goal of performing well on unseen future markets. Because future-market data are unavailable during development, historical data are divided into optimization and held-out evaluation periods.

2.1 BLACK-BOX OPTIMIZATION OVER STRATEGY PROGRAMS

  • Strategy design is framed as black-box optimization over executable programs, evaluated through an objective derived from backtest statistics.Strategies map observed market history to trading decisions and may include signal construction, entry and exit rules, position management, allocation, and risk control.Source: §2.1 · p. 3
  • A generic black-box optimizer proposes each new strategy based on previously evaluated candidates and their backtest results and objective values.The supplied formulation introduces a proposal operator for generating strategies at each iteration.Source: §2.1 · p. 3

2.2 OPTIMIZATION FOR GENERALIZABLE TRADING STRATEGY

  • The strategy's target is performance on future, unseen markets, rather than performance on the historical data available during optimization.The future-market distribution is unknown during strategy development.Source: §2.2 · p. 3
  • Available historical data are split into an in-sample period accessible during optimization and a held-out out-of-sample period used to evaluate generalization.The optimizer accesses backtest evaluations on the in-sample data only.Source: §2.2 · p. 3
  • TradeGrad's overview depicts an iterative loop of sampling archived strategies, revising from backtest feedback and optimization experience, then evaluating and archiving new strategies.Source: Figure 2 · p. 4

3 METHOD

TradeGrad reuses archived strategy experience to guide textual-gradient revisions at different scales, then evaluates candidates across historical windows. Its Cross-Period Robust Objective emphasizes lower-tail window performance so favorable periods cannot fully compensate for poor ones.

3.1 OVERVIEW

  • TradeGrad samples archived strategies, compares their code and backtest results with accumulated experience, uses an LLM-generated textual gradient to revise a base strategy, and evaluates and archives the result.Source: §3.1 · p. 4

3.2.1 PERIODIC GLOBAL OPTIMIZATION MEMORY

  • Every H iterations, TradeGrad consolidates recent optimization experiences into persistent global memory containing reusable successful and failure patterns.Between refreshes, it retains the latest memory.Source: §3.2.1 · p. 4

3.2.2 SAMPLING-BASED TEXTUAL GRADIENT ESTIMATION

  • Reference strategies are sampled with preference for higher-ranked candidates, while one sampled strategy is uniformly chosen as the base, allowing updates to start from different quality levels.Source: §3.2.2 · p. 4

3.2.3 MULTI-SCALE STRATEGY REVISION

  • Large-scale revisions rewrite core trading logic for structural exploration, whereas small-scale revisions make localized, diff-based edits while preserving strategy structure.Revision scale specifies the intended scope of modification during textual-gradient generation.Source: §3.2.3 · p. 5

3.3.1 CROSS-PERIOD EVALUATION

  • TradeGrad partitions in-sample data into non-overlapping historical windows and transforms each window's annualized return and maximum drawdown into bounded scores favoring higher returns and lower drawdowns.A one-sided trading-frequency gate penalizes activity below the desired minimum without rewarding excessive activity.Source: §3.3.1 · p. 5

3.3.2 LOWER-TAIL ROBUST OBJECTIVE

  • The Cross-Period Robust Objective optimizes the mean score of the lowest 30% of windows, preventing strong favorable-period results from fully compensating for poor performance elsewhere.Each evaluated strategy and its evaluation are added to the archive to inform subsequent textual-gradient updates.Source: §3.3.2 · p. 5

4 EXPERIMENTS

Experiments evaluate TradeGrad across Chinese A-share and U.S. equity markets, using cross-sectional and time-series settings and in-sample and out-of-sample evaluation. They assess overall performance, component ablations, hyperparameter sensitivity, and optimization trajectories.

4.1 EXPERIMENTAL SETUP

  • Evaluations use daily 2018–2025 data, split chronologically 3:1 into optimization and held-out periods, across two markets and two strategy settings.The study compares against market indices, classical strategies, evolutionary search, and TextGrad.Source: §4.1 · p. 6

4.2 OVERALL PERFORMANCE (RQ1)

  • TradeGrad achieves the highest IS and OOS Scores among compared methods in all four settings.Classical strategies remain competitive, while automated baselines struggle in cross-sectional trading.Source: §4.2 · p. 6, Table 1 · p. 7

4.3.1 ABLATION OF EXPERIENCE-GUIDED TEXTUAL-GRADIENT ESTIMATION

  • Removing any textual-gradient mechanism lowers IS and OOS Scores; global memory causes the largest OOS drop, while Rewrite-only beats Diff-only but trails MSR.The full method's OOS Score is 65.65, versus 35.62 without global memory.Source: Table 2 · p. 7, §4.3.1 · p. 7

4.4 HYPERPARAMETER ANALYSIS (RQ3)

  • Figure 3 examines sensitivity to memory horizon, gradient sample size, and probability of large revisions.Performance improves as the memory window grows from 3 to 5 before generally declining; one sample has the highest IS Score, while size 3 has stronger OOS performance, and larger samples degrade both. OOS performance generally improves with larger-revision probability but drops substantially at 0.9.Source: Figure 3 · p. 8, §4.4 · p. 8

4.3.2 ABLATION OF THE CROSS-PERIOD ROBUST OBJECTIVE

  • Removing the frequency gate reduces standardized IS Score from 10.69 to 8.10 and OOS Score from 65.65 to 40.24.The OOS Sharpe ratio also falls from 1.63 to 0.73.Source: §4.3.2 · p. 8
  • 65.65 versus 23.37 and 35.63: CPRO's OOS Score exceeds the Mean-Period and Aggregate Objectives, with higher AR and SR and lower MDD.CPRO also achieves the highest standardized IS Score; the table cautions that IS OV values are each variant's own objective and are not directly comparable across rows.Source: §4.3.2 · p. 8, Table 3 · p. 8

4.5 OPTIMIZATION TRAJECTORIES (RQ4)

  • TradeGrad's IS and OOS Scores rise throughout optimization, while TextGrad plateaus and Island Algorithm's gains are smaller and less persistent.Figure 4 plots strategies generated at each step and their 10-step moving averages.Source: §4.5 · p. 9, Figure 4 · p. 9

5 RELATED WORK

Prior automated trading-strategy research includes genetic-algorithm rule evolution and later robustness-focused evaluation practices. More recent LLM methods largely retain evolutionary search, whereas this work applies textual-gradient optimization with an explicit focus on out-of-sample robustness.

5 RELATED WORK

  • Early work used genetic algorithms to evolve trading rules across equity, foreign-exchange, and futures markets, searching strategy structures and parameters.Later studies emphasized robustness through risk-aware objectives, transaction costs, out-of-sample evaluation, and multiple market segments.Source: §5 · p. 9
  • Recent LLM systems including LLM-GA, QuantEvolve, and ProFiT generate and refine executable strategies within the evolutionary-search paradigm.Source: §5 · p. 9
  • TradeGrad explores textual-gradient optimization for trading strategy design, explicitly targeting out-of-sample robustness.Source: §5 · p. 9

6 CONCLUSION

The conclusion presents TradeGrad as an experience-guided textual-gradient method for trading-strategy optimization, with CPRO targeting temporal robustness. Experiments across two markets and two strategy settings show strong in-sample and out-of-sample performance, and the authors identify broader settings for future work.

6 CONCLUSION

  • TradeGrad reuses accumulated optimization experience to address textual gradients' myopic nature and uses CPRO to promote robustness across market periods.Source: §6 · p. 9
  • Experiments across Chinese A-share and U.S. markets and cross-sectional and time-series design show strong IS and OOS performance with favorable risk–return trade-offs.Further analyses validate the effectiveness of key components.Source: §6 · p. 9
  • Future work could extend TradeGrad to broader asset classes and higher-frequency settings, add richer market information, and examine more diverse distribution shifts.Source: §6 · p. 9
  • The authors report using generative AI tools for software code and parts of the paper, and state that they reviewed AI-assisted work and take responsibility for the final content.Source: AI USE STATEMENT · p. 10
  • The authors state that code, public datasets, and documented experimental settings are available to support reproduction of the reported results.Source: REPRODUCIBILITY STATEMENT · p. 10

A.1 ALGORITHM

The paper points readers to Algorithm 1 for a summary of the overall optimization procedure.

A.1 ALGORITHM

  • Algorithm 1 summarizes the overall optimization procedure.Source: §A.1 · p. 12

A.2.1 EVALUATION METRICS

In-sample evaluation reports CPRO as the common IS Score while preserving each method’s optimization protocol. OOS evaluation scores the selected strategy over the held-out period and reports standard return, drawdown, and risk-adjusted metrics.

Optimization procedure

  • TradeGrad iteratively samples evaluated strategies, applies textual-gradient revisions, evaluates candidate strategies, and returns the candidate with the highest objective score.The algorithm also periodically updates its memory from recent evaluated candidates.Source: §A.2.1 · p. 13

In-sample evaluation

  • TradeGrad uses CPRO for optimization and selection, while classical strategies and automated baselines generally use IS SR and QuantEvolve follows its original objective.The reported IS Score is a common evaluation criterion; automatically searched strategies include a trading-frequency gate, while classical strategies and the market-index reference omit its penalty.Source: §A.2.1 · pp. 12–13

Out-of-sample evaluation

  • The OOS Score evaluates the selected strategy over the entire held-out period without cross-period lower-tail aggregation or a trading-frequency gate.The OOS evaluation reports annualized return, maximum drawdown, and Sharpe ratio as standard performance metrics.Source: §A.2.1 · p. 13

Out-of-sample metrics

  • Annualized return measures portfolio growth, maximum drawdown measures the largest peak-to-trough decline, and Sharpe ratio measures risk-adjusted return relative to volatility.Source: §A.2.1 · p. 13

A.2.2 EXPERIMENTAL PROTOCOL

The experiments use a held-out OOS period and shared LLM evaluation conditions, with results averaged over three runs and standard deviations reported separately. The case study traces a strategy’s non-monotonic evolution, while the related-work discussion frames TradeGrad’s response to limited exploration and historical overfitting.

A.2.2 EXPERIMENTAL PROTOCOL

  • The protocol exposes up to 252 preceding trading days, with no held-out OOS observations available during optimization or selection, and gives LLM methods a shared setup and 100-candidate budget.All results are averaged over three runs; ablations, hyperparameter analyses, and optimization trajectories use the CSI 300 cross-sectional setting.Source: §A.2.2 · pp. 13–14

A.3 STANDARD DEVIATIONS OF MAIN RESULTS

  • Performance is consistent across three independent runs, with Table 4 reporting standard deviations corresponding to Table 1’s mean results.Source: §A.3 · p. 14, Table 4 · p. 14

A.4 CASE STUDY

  • The case study’s final strategy grows from nine lines of closing-price momentum logic to 78 lines combining price, volume, and trading-amount signals with regime-aware filters and hysteresis.Its components include trend quality, efficiency ratio, ATR-normalized momentum, liquidity filtering, and holding hysteresis; the search restructures executable logic beyond parameter tuning or local signal adjustment.Source: §A.4 · pp. 14–15
  • Across eight generations, the representative strategy’s IS Score rises from 0.24 to 9.84 despite several temporary declines along its lineage.Examples of declines include 0.24 to 0.10, 0.79 to 0.36, and 6.42 to 5.90.Source: §A.4 · p. 15

A.5 MORE RELATED WORK

  • TradeGrad addresses trading’s limited exploration and historical-backtest overfitting with population-based textual-gradient optimization and a cross-period robust objective.The related-work discussion distinguishes trading’s need to generalize to unseen markets from program optimization on a given evaluation problem.Source: §A.5 · pp. 15–16
Loading 2610.03128v1…