Reinforcement Learning with Expert Trajectory For Quantitative Trading

Sihang Chen, Weiqi Luo, Chao Yu · DOI

Abstract

In recent years, quantitative investment methods combined with artificial intelligence have attracted more and more attention from investors and researchers. Existing related methods based on the supervised learning are not very suitable for learning problems with long-term goals and delayed rewards in real futures trading. In this paper, therefore, we model the price prediction problem as a Markov decision process (MDP), and optimize it by reinforcement learning with expert trajectory. In the proposed method, we employ more than 100 short-term alpha factors instead of price, volume and several technical factors in used existing methods to describe the states of MDP. Furthermore, unlike DQN (deep Q-learning) and BC (behavior cloning) in related methods, we introduce expert experience in training stage, and consider both the expert-environment interaction and the agent-environment interaction to design the temporal difference error so that the agents are more adaptable for inevitable noise in financial data. Experimental results evaluated on share price index futures in China, including IF (CSI 300) and IC (CSI 500), show that the advantages of the proposed method compared with three typical technical analysis and two deep leaning based methods.

Introduction

Quantitative trading in financial markets is notoriously difficult due to the "low signal-to-noise ratio" of market data. Traditional supervised learning methods often struggle because they treat price prediction as a static classification or regression task, ignoring the long-term consequences of trading decisions and the reality of delayed rewards.

Reinforcement Learning (RL) seems like a natural fit, but it faces two major hurdles. First, the Exploration Problem: standard RL agents (like DQN) start with zero knowledge and must explore randomly. In high-stakes, noisy financial environments, this "random walk" phase is inefficient and often fails to converge. Second, the Generalization Gap: imitation learning techniques like Behavior Cloning (BC) try to copy an expert's actions directly. However, if the agent drifts slightly away from the expert's path, it enters "out-of-distribution" states where it lacks guidance, leading to catastrophic failures.

Methodology: Learning from Hindsight

The authors propose a novel RL framework that models trading as a Markov Decision Process (MDP) but changes how the agent learns from "perfection."

The Hindsight Expert

During the training phase, the authors construct an "expert" that has access to future prices. This expert always takes the mathematically optimal action (e.g., going long if the price will rise in the next interval). This provides a clear target for the agent to aspire to, bypassing the need for purely random exploration.

Hybrid TD-Error

Instead of just copying the expert's actions (BC) or learning solely from its own mistakes (DQN), the agent uses a hybrid loss function. It calculates two Temporal Difference (TD) errors: one based on its own interactions with the environment ($L^a$) and one based on the expert's interactions ($L^e$).

The proposed RL framework architecture featuring the hybrid loss function derived from both agent and expert trajectories.

The final loss is the average of the two: $L = (L^a + L^e)/2$. This forces the Q-network to value states and actions similarly to an optimal player while still maintaining the ability to reason about its own trajectory. This "guidance over imitation" approach ensures the agent learns why a state is valuable, not just what button to press.

State Representation and Architecture

Rather than just using raw price and volume (OHLCV), the model incorporates over 100 "short-term alpha factors"—mathematical expressions capturing momentum, volatility, and other statistical properties. The core of the agent is an LSTM (Long Short-Term Memory) network, which is well-suited for capturing the temporal dependencies inherent in financial time-series data.

Experimental Setup

The model was evaluated on two major Chinese share price index futures:

  • IF (CSI 300): Represents the top 300 stocks on the Shanghai and Shenzhen exchanges.
  • IC (CSI 500): Represents 500 small-to-mid-cap stocks.

The researchers used tick-level data from October 2015 to October 2020, aggregated into 5-minute intervals. The data from 2015 to 2019 was used for training, while the final year served as the out-of-sample testing period.

Key Results

The proposed method was compared against three technical baselines (Buy & Hold, MACD, Dual Thrust) and two RL baselines (DQN, BC).

  • Profitability: In the IF market, the proposed method achieved an accumulated profit of 1064.0, significantly higher than DQN (796.4) and MACD (426.6). In the IC market, the gap was even wider: 1934.3 for the proposed method vs. 1317.3 for DQN.
  • Risk-Adjusted Returns: The model achieved a Sharpe Ratio of 2.09 (IF) and 1.86 (IC), nearly double that of the standard RL and technical analysis methods.
  • Robustness to Noise: By anchoring the learning process to an expert trajectory, the agent is less likely to get lost in the "noise" of random market fluctuations during the early stages of training.

Conclusion and Future Work

The study demonstrates that incorporating hindsight-based expert trajectories into the RL training loop significantly improves performance in volatile financial markets. The model performed better at 5-minute intervals than at 30-minute intervals, suggesting that the "alpha" found is short-lived and requires higher-frequency execution.

Future work could explore dynamic weighting of the loss function (relying more on the expert early in training) and incorporating risk measures like the Sharpe ratio directly into the reward function to further stabilize the agent's performance.

Reference: Chen, S., Luo, W., & Yu, C. (2021). Reinforcement Learning with Expert Trajectory For Quantitative Trading. arXiv:2105.03844v1 [cs.LG].

Summary updated

BibTeX
@misc{chen2021reinforcement,
  author = {Sihang Chen and Weiqi Luo and Chao Yu},
  title = {{Reinforcement Learning with Expert Trajectory For Quantitative Trading}},
  year = {2021},
  eprint = {2105.03844},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2105.03844},
}
Figure