Source-linked AI summary

Agent Memory with Episodic Retrieval for Financial Decision-Making

Nuoyue Xu, Jiang Liu, Wenxuan Huang, Xiang Zhang, Juntai Cao, Jiaqi Wei

arXiv:2609.28771v1cs.AI

TL;DR

Trading agents face rapidly evolving markets, while prior approaches include stateless analysis and memory systems that do not generalize to financial time series. META combines specialized indicator agents with episodic retrieval and reflection, and reports consistent outperformance of baselines across diverse assets in zero-shot experiments.

  • Problem

    Trading agents must handle rapidly evolving, high-dimensional markets, while existing dynamic-memory frameworks for text tasks do not generalize to numerical, non-stationary financial time series.

    Source: §1 · p. 1
  • Method

    META combines specialized Signal Agents, retrieval of analogous past trades, and synthesis of current analyses with retrieved precedents into context-aware decisions.

    Source: §1 · p. 1, §3.4 · p. 5
  • Results

    Experiments across diverse assets in a zero-shot setting show that META consistently outperforms baselines.

    Source: §5 · p. 9
  • Takeaways & Limitations

    The reported experiments support memory-driven contextual recall for high-frequency decision making.

    Source: §5 · p. 9

    Evaluation uses retrospective historical-data simulation and omits live execution effects, including slippage, transaction costs, and real-time latency constraints.

    Source: Limitations · p. 9

Abstract

from arXiv · show

Large language models (LLMs) have demonstrated strong capabilities in financial analysis and reasoning, inspiring recent advances in agent-based trading frameworks. While these systems show promise, prior approaches either emphasize long-horizon forecasting or operate as stateless analyzers, limiting their applicability to the demands of trading in complicated settings. To address these gaps, we introduce META (Memory Enhanced Trading Agent), the first RAG-like episodic-memory-augmented multi-agent framework for financial decision making. META integrates a family of specialized indicator agents (e.g., Trend, MACD, Stochastic, RSI, SMA, AVWAP, Heikin-Ashi) with a Decision Agent that fuses their reports, and a Memory module that retrieves and updates past trading episodes encoded as market state embeddings with outcomes and reflections. By recalling relevant experiences and adaptively reweighting signals under similar market regimes, META achieves improved directional accuracy and robustness under short-horizon evaluation. Our results demonstrate that episodic memory provides a powerful mechanism for regime-aware, interpretable, and low-latency decision-making in trading and decision making. The code of this project is released on GitHub.

1 Introduction

Trading agents face rapidly changing, high-dimensional markets, while LLM agents often make decisions without learning from prior outcomes. META adds episodic memory to a multi-agent workflow that retrieves analogous trades and combines them with current market analysis.

1 Introduction

  • High-frequency trading requires decisions under strict latency constraints as profitable patterns can invert within minutes.Traditional quantitative systems use handcrafted logic for low-latency execution but can collapse under regime shifts.Source: §1 · p. 1
  • Stateless LLM agents make each decision in isolation, limiting their ability to adapt by learning from prior outcomes.Markets are characterized by recurrence and volatility.Source: §1 · p. 1
  • Existing dynamic-memory frameworks for text tasks do not generalize to financial time series’ stochastic, high-dimensional numerical structure.The paper argues that market memory must handle numerical and non-stationary states.Source: §1 · p. 1
  • META uses specialized Signal Agents to analyze market streams, retrieves analogous prior trades, and fuses both sources into context-aware decisions.Its dual-stream representation separates symbolic indicator vectors for reasoning and retrieval from normalized price–volume embeddings for similarity search.Source: §1 · p. 1
  • META embeds retrieval-augmented episodic memory directly into the high-frequency decision loop and reports gains in profitability and stability over stateless baselines.The memory operator extends dynamic-memory principles to structured numerical domains and grounds reasoning in market feedback.Source: §1 · p. 2

2 Related Work

Prior LLM trading work spans several approaches, while agent-memory research addresses long-term reasoning with persistent stores and retrieval. META applies structured indicator-based memory and reflection to quantitative trading.

LLMs for Financial Decision-Making

  • LLM trading agents use news and social-media sentiment, reinforcement learning, or explicit reasoning frameworks.The cited work also describes inference-time search over intermediate decision states and a shift toward autonomous agents that plan and act over extended horizons.Source: §2 · p. 2
  • META advances reasoning-driven trading with an Indicator Vector for retrieving analogous historical scenarios via cosine similarity.Its memory update and reflection loop refines memory based on trade outcomes; unlike alpha-factor-generation systems, it adapts decisions using established indicators.Source: §2 · p. 2

Memory Mechanisms in Agents

  • Agent-memory research moved from appending full interaction histories to external memory frameworks, but persistent challenges include decoupled memory and reasoning and full-history accumulation.Retrieval-augmented systems also indicate that retrieved evidence may need test-time critique and optimization before informing decisions.Source: §2 · p. 3
  • META addresses quantitative trading with structured indicator-based memory, cosine-similarity retrieval, and a reflection-driven decision cycle.The workflow comprises perception, synthesis using retrieved precedents, and memory-buffer updates through reflection-augmented consolidation.Source: §2 · p. 3, Figure 2 · p. 3

3 Method

META decomposes trading into perception, memory, and synthesis, using modular processing and non-parametric retrieval for interpretable decisions. Its method combines symbolic and numerical market representations, parallel signal reports, retrieved episodes, and evidence-first decision synthesis.

3 Method

  • META decomposes trading into Perception, Memory, and Synthesis operators, creating an explicit, auditable workflow rather than an end-to-end black box.The design uses non-parametric memory for generalization and supports retrieval-grounded decisions.Source: §3 · p. 3

3.1 Problem Formulation

  • The policy maps a market state and time-varying episodic memory to a structured decision, with the objective of maximizing expected cumulative return.The policy is presented as a composition of interpretable modules, supporting specialized processing, retrieval-augmented generalization, and transparent inference chains.Source: §3.1 · pp. 3–4

3.2 Bifurcated State Representation

  • META’s bifurcated state representation pairs symbolic domain features with normalized raw market microstructure.The symbolic stream supports interpretable reasoning and abstraction, while the numerical stream supports precise similarity retrieval of market configurations.Source: §3.2 · p. 4

3.3 Perception Operator (Φ)

  • The perception operator distributes market-state processing across specialized Signal Agents, each producing a compact report.Reports combine quantitative metrics, such as indicator strength, with qualitative semantics, such as divergence or breakout signals; agents can be refined or replaced independently.Source: §3.3 · p. 4

3.4 Memory Operator (Ψ)

  • The memory operator retrieves analogous trading episodes by cosine similarity and curates its repository by pruning low-utility or redundant entries and retaining novel, high-impact ones.Each episode includes its outcome and optional reflection, which the agent re-critiques and re-weights at test time rather than appending verbatim.Source: §3.4 · pp. 4–5

3.5 Synthesis Operator (Π)

  • The synthesis operator combines perceptual summaries and retrieved episodes into a structured decision containing an action, confidence, selected evidence, and rationale.Evidence-first decoding selects the evidence before generating a rationale, supporting grounded, auditable explanations while keeping the additional token budget small enough for HFT latency limits.Source: §3.5 · p. 5

4 Experiments and Results

Experiments compare META with QUANTAGENT and a random policy across five assets using 4-hour OHLCV data, assessing directional accuracy and return-based metrics.

4.2 Main Results

  • META outperforms both baselines across accuracy and return metrics on five assets; CL accuracy is competitive, and Rmin is least negative except on QQQ.Source: §4.2 · pp. 5–6, Table 1 · p. 6

4.3 Text Embeddings vs. Indicator Vectors

  • Indicator-vector retrieval raises accuracy 2–10% over text embeddings, including 56.0% to 64.0% on ES; its lower mean similarity but higher variance sharpens retrieval selectivity.Source: §4.3 · p. 6, Table 2 · p. 6, Figure 4 · p. 7

4.4 Memory Retrieval Guidance

  • At τ = 0.7, retrieved counts rise as memory grows; with k = 10, similarity improves, while τ = 0.6–0.7 and k = 5–15 balance coverage and reliability.Source: §4.4 · p. 7, Figure 5 · p. 8

4.5 Latency-Aware Retrieval Analysis

  • Indicator-vector retrieval improves accuracy by 2–11 percentage points and cuts latency from approximately 3.1 seconds to 0.006 seconds per query, averaging a 500× speedup.Source: §4.5 · p. 7, Table 3 · p. 7

4.6 Learning Dynamics with Memory Accumulation

  • After the analysis begins at 300 memories, directional accuracy trends upward across assets, with a transient volatility window around 300–350 trades as retrieval stabilizes.Source: §4.6 · p. 8, Figure 6 · p. 8

4.7 Robustness Under Varying Market Conditions

  • Across uptrend, downtrend, steady, and sudden-change regimes, accuracy variation stays within 4–6%; stability is greatest in steady markets, and QQQ reaches 0.60 accuracy during shocks.Source: §4.7 · p. 8, Figure 7 · p. 8

4.8 Memory System Ablation

  • Adding memory improves accuracy across assets, with ES rising from 50.0% to 64.0% (+14.0 points) and NQ from 40.0% to 62.0% (+22.0 points); stable assets also gain.Source: §4.8 · p. 9, Table 4 · p. 9

4.9 Indicator Contributions

  • Removing any indicator lowers accuracy; Trend (−2.42%) and MACD (−2.02%) yield the largest declines, while smaller AVWAP and SMA effects suggest partial redundancy.Source: §4.9 · p. 9, Figure 8 · p. 9

5 Conclusion

META combines specialized Indicator Agents, decision fusion, and a dynamic Memory Operator for adaptive, interpretable trading decisions; experiments across diverse assets show consistent outperformance of baselines.

5 Conclusion

  • META is a memory-augmented trading framework combining multi-agent market perception with reflective reasoning.Its architecture integrates specialized Indicator Agents, decision fusion, and a dynamic Memory Operator.Source: §5 · p. 9
  • The framework enables adaptive and interpretable trading decisions in a zero-shot setting.Source: §5 · p. 9
  • Extensive experiments across diverse assets show META consistently outperforms baselines.Source: §5 · p. 9

Limitations

META’s limitations concern its perceptual inputs, fixed retrieval metric, and retrospective evaluation rather than live market execution.

Limitations

  • Handcrafted technical indicators ground perception and may limit scalability to diverse market structures or alternative data modalities.Source: Limitations · p. 9
  • Similarity-based memory retrieval remains static; learned or adaptive retrieval metrics are proposed for future work.Source: Limitations · p. 9
  • Evaluation uses retrospective historical-data simulation and omits slippage, transaction costs, and real-time latency constraints.Source: Limitations · p. 9

A Prompts

The appendix prompts ground specialized agents’ trading signals in generated indicator charts, using indicator-specific visual patterns and structured outputs.

A.1 MACD Agent

  • The MACD agent generates a chart from OHLC data before assessing momentum through crossovers, histogram changes, divergence, and distance or slope from zero.The prompt requires image analysis before making a momentum or trading prediction.Source: §A.1 · p. 12
  • The MACD prompt returns a buy, sell, or hold signal with momentum direction, confidence, evidence, and risk considerations.Source: §A.1 · p. 12

A.2 AVWAP Agent

  • The AVWAP agent first generates a chart from OHLC data, then interprets price relative to anchored volume-weighted average price.Its prompt requires chart analysis before predictions.Source: §A.2 · p. 13
  • The AVWAP prompt assesses support or resistance, mean reversion, breakouts, slope, fair-value deviation, and volume context.It requests a trade signal and bias alongside entry, risk, and volume assessments.Source: §A.2 · p. 13

A.3 RSI Agent

  • The RSI agent generates an OHLC-derived chart before inferring directional bias from momentum, reversals, and divergences.Its prompt specifies overbought and oversold zones and a centerline for visual analysis.Source: §A.3 · p. 14
  • RSI analysis also covers failure swings, price–RSI divergences, trendline breaks, and swing rejections, then returns a signal with confidence and risk considerations.Source: §A.3 · pp. 14–15

A.4 Heiken Ashi Agent

The Heiken Ashi, SMA, and Stochastic agents use chart-based indicator readings to assess short-term direction, momentum, and potential trading signals. Each first generates its chart, then grounds its analysis in visible patterns or indicator behavior.

A.4 Heiken Ashi Agent

  • The Heiken Ashi agent reads smoothed candle sequences for trend direction, momentum changes, reversals, consolidation, and possible entry or exit timing.Its outputs include trend status, momentum phase, signal quality, trading action, and false- or conflicting-signal risk.Source: §A.4 · pp. 15–16

A.5 SMA Agent

  • The SMA agent generates a chart of multiple moving averages and evaluates price alignment, crossovers, slope, and spacing to infer trend direction and momentum shifts.The prompt describes 20-, 50-, and 200-period SMAs as representing different trend horizons.Source: §A.5 · p. 16

A.6 Stochastic Agent

  • The Stochastic agent uses %K and %D, overbought and oversold levels, crossovers, divergences, and oscillator slope to assess short-term momentum and possible reversals.Its requested outputs include a primary signal, momentum direction, confidence, supporting patterns, and risk considerations.Source: §A.6 · pp. 17–18

A.7 Trend Agent

The Trend agent grounds near-term directional analysis in automatically generated trendlines and price interaction. The Decision agent combines indicator reports with relevant memories for a trade decision, then reflects on outcomes to guide future calibration.

A.7 Trend Agent

  • The Trend agent visualizes recent OHLC data with support and resistance trendlines, then interprets slope, compression, and breakout behavior for near-term direction.Its analysis also considers trendline interaction, candlestick behavior, and breakout probability.Source: §A.7 · pp. 18–19

A.8 Decision Agent

  • The DecisionAgent’s pre-decision synthesis combines agent reports with retrieved memories, weighs signal alignment and conflicts, and issues immediate LONG or SHORT orders with risk–reward set to [1.2, 1.8] based on volatility and conviction.Source: §A.8 · p. 19

REQUIRED OUTPUT FORMAT (JSON): Return only valid JSON

  • The post-decision reflection reviews decision quality, execution, learning, and memory integration, with lessons intended to inform future signal weighting and confidence calibration.The reflection considers the trade outcome, what worked or failed, and concrete adjustments for similar future setups.Source: REQUIRED OUTPUT FORMAT (JSON): Return… · p. 20

B Computation and Mathematical Formulation of Indicators

This appendix defines six indicators computed from OHLCV data and describes how each characterizes market dynamics. The indicators supply quantitative inputs to META's multi-agent reasoning framework.

B Computation and Mathematical Formulation of Indicators

  • The appendix presents the six integrated indicators as distinct perspectives on market dynamics, including momentum, mean reversion, trend persistence, and value anchoring.All are computed from raw OHLCV data and serve as quantitative inputs to the multi-agent framework.Source: B Computation and Mathematical… · p. 20

B.1 Moving Average Convergence Divergence (MACD)

  • MACD compares short- and long-term exponential moving averages to measure momentum; its signal-line crossovers indicate potential reversals, while histogram expansion suggests strengthening momentum.The common fast and slow parameters are 12 and 26.Source: §B.1 · p. 20

B.2 Relative Strength Index (RSI)

  • RSI compares average gains and losses over a lookback period, with readings above 70 denoting overbought conditions and readings below 30 suggesting oversold conditions.The passage gives n = 14 as a typical lookback and treats crossings of 50 as transitions in trend dominance.Source: §B.2 · p. 21

B.3 Anchored Volume Weighted Average Price (AVWAP)

  • AVWAP is the cumulative volume-weighted mean of traded prices since a specified event-time anchor, with price and volume contributing to the calculation.The anchor may be a major news event or breakout; price above or below AVWAP is interpreted as a bullish premium or bearish discount phase.Source: §B.3 · p. 21

B.4 Simple Moving Average (SMA)

  • SMA averages the most recent closing prices, filtering short-term noise; shorter windows respond faster, while longer windows define macro-trend bias.A short-above-medium-above-long ordering indicates trend strength, whereas frequent crossovers reflect low directional conviction or range-bound conditions.Source: §B.4 · p. 21

B.5 Stochastic Oscillator

  • The Stochastic Oscillator measures the current close's position within a recent price range, using the period's highest and lowest prices.Readings above 80 suggest potential overbought conditions and below 20 indicate oversold conditions; %K and %D crossovers provide early entry and exit signals.Source: §B.5 · p. 21

B.6 Heiken Ashi (HA)

  • Heiken Ashi transforms and smooths OHLC data to reduce noise; uniform-color candle sequences represent strong trends, while small bodies or alternating colors indicate weakening momentum or consolidation.The passage describes this smoothing as useful in high-frequency settings where standard candlestick noise can obscure persistent directional biases.Source: §B.6 · pp. 21–22

C Case Study

The case study follows META through memory-informed indicator analysis, retrieval of analogous trading episodes, decision-making, and reflective memory updates. It uses a predominantly bearish market with tentative reversal signals and trade outcomes to illustrate how recalled experience informs cautious reasoning and ongoing adaptation.

Trading cycle

  • META analyzes K-line data with specialized agents, retrieves similar episodes by cosine similarity, combines memories and live reports into a LONG, SHORT, or HOLD decision, then updates episodic memory after the trade.The Reflection Module adds, refines, or prunes trade instances based on the outcome.Source: C Case Study · p. 22

Trend Agent

  • The Trend Agent describes downward-sloping support and resistance, consolidation, and a slight downward bias, while noting that a support break would confirm further downside.Repeated resistance tests failed; a break above resistance could instead signal reversal.Source: C Case Study · p. 22

MACD Agent

  • The MACD Agent reports a bearish crossover below zero and negative momentum, but a contracting histogram and declining slope indicate deceleration and possible momentum shift.It assigns medium confidence and flags false signals as a risk.Source: C Case Study · p. 22

AVWAP Agent

  • The AVWAP Agent recommends Sell as price trades below a downward-sloping AVWAP acting as resistance, with volume confirming bearish action despite potential mean reversion.The report suggests short entries on rallies toward AVWAP after rejection.Source: C Case Study · p. 23

Heiken Ashi Agent

  • Heiken Ashi candles show a clean bearish sequence, but smaller recent candles, indecision, and late green candles suggest fading momentum and a possible reversal.The agent gives medium confidence and advises waiting for a strong green candle to confirm a reversal.Source: C Case Study · pp. 23–24

Multi-Candle Pattern Analysis

  • Three consecutive same-color candles confirm trends, while recent green candles suggest a possible reversal and the extended red sequence nears exhaustion.The case study notes both green and red sequences.Source: C Case Study · p. 24

Comprehensive Assessment

  • The assessment is weak bearish transitioning to sideways with decelerating momentum, recommending waiting for a strong green-candle confirmation and caution over false signals.Exit if strong-bodied red candles with minimal wicks reappear.Source: C Case Study · p. 24

SMA Agent Output Response

  • Price below both SMAs, a 20-period death cross, bearish stacking, and downward slopes support a strong bearish trend.The primary trend direction is bearish.Source: C Case Study · p. 24
  • The 20-period SMA near 86000 acts as resistance, supporting a sell-on-rallies bias despite potential short-term mean reversion or pullback.The analysis says to consider selling on rallies, especially as price approaches that resistance.Source: C Case Study · p. 24

Stochastic Oscillator Agent Output Response

  • The Stochastic is below 20 and below its centerline, but a bullish %K/%D crossover in oversold territory and upward slopes suggest a possible reversal.Bearish momentum and unconfirmed price action leave room for false signals.Source: C Case Study · p. 25

RSI Agent Output Response

  • RSI near 40 and ranging from 30 to 50 indicates bearish, non-extreme momentum, although bullish divergence suggests a possible reversal that warrants caution.The RSI is below 50 and has not reached overbought or oversold territory.Source: C Case Study · p. 25

Memory Retrieval

  • META encodes aggregated indicator outputs into a vector and retrieves similar past trades as experiential references for its decision process.Source: C Case Study · pp. 25–26

Retrieved Memory

  • Retrieved bearish episodes show mixed outcomes: one short succeeded, while another lost despite bearish indicators, prompting better historical weighting, adaptive stops, and broader-market consideration.The successful episode cited a descending triangle and price below VWAP and SMAs; the losing episode cited MACD, SMA, and AVWAP signals.Source: C Case Study · p. 26

C Case Study

  • META chose a SHORT based on a descending triangle and bearish indicators, while mixed historical outcomes supported medium confidence and a stop above recent highs near AVWAP.The synthesis stage adjusts indicator weighting and moderates confidence when similar patterns have mixed outcomes.Source: C Case Study · p. 27
  • +615.30 PnL produced a WIN on META’s SHORT forecast, with price following bearish continuation and execution meeting the 1.5 risk–reward target.The trade entered at 82,548.81 and exited at 81,933.51.Source: C Case Study · p. 27
  • Reflection credited the profit to the descending triangle and bearish MACD and moving-average signals, while recommending stronger confidence for confluence and volatility-aware stop placement.The reflection judged the original analysis sound but saw room to increase conviction from the aligned indicators.Source: C Case Study · p. 27
  • After the trade, META’s Memory Operator can retain, update, or remove precedents and encodes the completed trade as a new episodic memory.The consolidation summary describes updating profitable analogs, pruning uninformative cases, and adding the new trade record.Source: C Case Study · pp. 27–28
  • The workflow grounds reasoning in historical evidence, keeps outputs interpretable through explicit agent-level reports, and enables continual learning without retraining.Reflection-driven memory management is presented as a way to refine the knowledge base as market conditions change.Source: C Case Study · p. 28

D Metrics Design

The metrics assess short-horizon directional accuracy, profitability, risk bounds, and alignment between retrieved memories and realized returns. They use a fixed three-candlestick evaluation horizon and risk-constrained execution.

D Metrics Design

  • Directional accuracy counts correctly predicted candles over the three-candlestick evaluation horizon.For LONG decisions, closes above the current close count as correct; for SHORT decisions, closes below it count as correct.Source: D Metrics Design · p. 28
  • Rate-of-return metrics use a fixed 0.05% stop-loss threshold and a model-generated risk–reward ratio to set gain and loss limits.Each trade exits at the first intra-candle threshold hit; cumulative return records the realized outcome at that exit.Source: D Metrics Design · p. 28
  • Maximum and minimum return capture the best-case outcome and the most adverse price movement within the same horizon.Rmax is an upper bound on potential profit, while Rmin captures worst-case drawdown under the same trade direction.Source: D Metrics Design · p. 29
  • Similarity-weighted Return Alignment assesses whether retrieved memories’ similarity weights align with their realized profitability.Higher Rsim indicates that retrieved memories’ return patterns align with the current market context.Source: D Metrics Design · p. 29
  • The metric suite combines directional accuracy, realized profitability, return bounds, and similarity-weighted alignment between retrieved experiences and outcomes.All metrics are computed within a fixed three-candlestick horizon under the QUANTAGENT evaluation protocol.Source: D Metrics Design · pp. 28–29

E Use of Large Language Models (LLMs)

LLMs were used only for editorial assistance, chiefly to refine manuscript readability and stylistic consistency. The authors retain responsibility for the scientific and technical work.

E Use of Large Language Models (LLMs)

Loading 2609.28771v1…