From Research Reports to Indicator Formulas: A Practical Guide to Reproducing Quantitative Strategies with Large Language Models
This guide explains how to use large language models to reproduce quantitative trading indicators from sell-side research reports. It covers why strategy reproduction has traditionally been a high-barrier task, why coding-oriented tasks best reveal a model's real capabilities, a complete end-to-end workflow (document parsing, formula translation, error correction, and manual validation), and an efficiency comparison showing how reproduction cycles shrink from weeks to under an hour, along with an honest assessment of current model limitations.
From Research Reports to Indicator Formulas: A Practical Guide to Reproducing Quantitative Strategies with Large Language Models
1. Background: Why Strategy Reproduction Has Always Been a High-Barrier Task
In quantitative investing, broker research reports are a major source of strategy ideas. A typical financial engineering report contains indicator definitions, mathematical derivations, parameter settings, backtesting frameworks, and market-timing logic—all at very high information density. Take a moving-average-based timing indicator as an example: its definition may simultaneously involve weighting schemes, sliding windows, median smoothing, and multi-period confluence. Each step requires the reproducer to understand both the mathematical expressions and the formula syntax of the target charting software.
Traditionally, the workflow looked like this: a researcher with a financial engineering background reads the full report, manually decomposes the formulas, translates them line by line into an indicator script, and then iterates through backtesting and validation. Even for experienced developers, going from understanding a structurally complex strategy report to a working indicator reproduction typically takes one to two weeks of intensive effort. The bottlenecks fall into three areas:
- High cost of information extraction: Reports are often scanned PDFs or complex layouts, with formulas scattered across body text, figures, and appendices. Locating them manually is inefficient.
- Error-prone syntax mapping: Different charting platforms differ significantly in built-in functions, comment conventions, and plotting directives, so translation easily introduces subtle errors.
- Long iteration cycles: A single wrong function name or misplaced bracket forces a return to the report for re-verification, over and over.
This raises a natural question: can a large language model directly “read the report, write the formula, and fix the errors”? It turns out to be an excellent litmus test for a model’s real programming and reasoning ability.
2. Why Coding Tasks Best Reveal a Model’s True Capabilities
Community criticism of the previous generation of open-source flagship models focused on several typical pain points: insufficient stability on complex multi-step tasks, occasional tool-call failures, lost constraints in long contexts, and hallucinated outputs. These issues are barely visible when “writing an ordinary script,” but they are magnified enormously in tasks like quantitative formula reproduction, which simultaneously demands:
- Document comprehension: extracting unstructured formula definitions from PDFs;
- Formal translation: mapping natural language and mathematical notation into strict target syntax;
- Planning and self-checking: planning before executing multi-step tasks and locating root causes after errors;
- Tool coordination: invoking document parsing, file read/write, and other tools to close the loop.
The key improvements in the new generation of open-source models can be summarized in three points:
- Proactive thinking and planning: instead of emitting code immediately upon receiving a complex task, the model first decomposes the steps and formulates an execution plan, significantly reducing “write-and-break” behavior.
- Interleaved reasoning: reasoning is interleaved with action calls during execution, with intermediate verification after each step, noticeably lowering the error rate on long-chain tasks.
- Context and stability optimization: the effective context is constrained to a more controllable range, trading some ultra-long-text capability for output stability and a higher first-pass rate on code.
Combined, these improvements produce a very tangible effect for developers: the share of time spent debugging drops from “the majority” to “a small fraction,” and first-attempt success on complex tasks improves substantially.
3. Case Study: Reproducing a Moving-Average Timing Indicator from a Research Report
The following real workflow illustrates the complete reproduction process. The goal: have the model extract the definition of a specific moving-average indicator from a research report PDF about a moving-average timing strategy, and reproduce it in the formula syntax of the target charting software.
3.1 Task Design Principles
When instructing the model, all task elements should be stated clearly up front. A high-quality prompt should include:
- An explicit reference to the input material (the report file path);
- The tools or skills expected to be used (document parsing capability);
- Output syntax conventions (target formula format, comment style—ideally with a format example file attached);
- Process requirements (save the execution process as a log for auditing and traceability).
An illustrative prompt structure:
@research_report.pdfPlease use your document parsing capability to extract the completedefinition of the XX moving average from this file, and reproduce theindicator using the formula syntax of the target charting software.Refer to @example.txt for the formula format, and use // for inline comments.Save the entire execution process as a log file.
This four-element pattern—material + skill + format constraints + process logging—is key to improving first-attempt success.
3.2 Document Parsing: Extracting the Indicator Definition
The model first invokes document parsing to locate the indicator definition in the report. At this stage it must distinguish three types of information—body text descriptions, mathematical formulas, and parameter specifications—and restore the definition into a structured form, for example:
Indicator composition:1. Apply N-day weighted smoothing to the closing price series to obtainthe base moving average;2. Take the M-day median of the base moving average to obtain thesmoothed median line;3. A buy signal is generated when the base MA crosses above the medianline; a sell signal when it crosses below.
Compared with manual reading, the model completes locating and structuring within tens of seconds, and can simultaneously capture parameter constraints scattered across different chapters (such as the decay pattern of the weighting coefficients).
3.3 Formula Translation: From Mathematical Definition to Indicator Script
With the structured definition in hand, the model translates it into the target formula language. Illustrative code:
// Base MA: N-day weighted smoothingBASE_MA: WMA(CLOSE, N);// Smoothed median line: M-day median of the base MAMID_LINE: MEDIAN(BASE_MA, M);// Timing signalsBUY_SIGNAL: CROSS(BASE_MA, MID_LINE); // Cross above: buySELL_SIGNAL: CROSS(MID_LINE, BASE_MA); // Cross below: sell
This stage most readily exposes a model’s boundary issues. For example, some classic charting platforms do not provide a built-in median function; if the model directly calls a nonexistent function, the indicator will fail client-side validation. The right way to handle this is not to let the model “guess,” but to feed the error message back so it can construct an equivalent implementation from available functions:
// If no built-in median function exists, a sorting-based approximation// can be used: sort the values in the window and take the middle element.// For odd-sized windows, use the element at position (M+1)/2.// The exact implementation depends on the function set supported by// the target software.
In practice, after feeding back “this function does not exist,” the model typically produces a formula that passes validation in just one revision round. This demonstrates the new generation’s progress in error localization and self-repair: it accurately understands the semantics of the error rather than blindly rewriting the entire code block.
3.4 Manual Validation and Backtesting
It must be emphasized that the manual step cannot be skipped. The model-generated formula should be pasted into the charting software for syntax validation, and its shape compared against the example figures in the report. A recommended checklist:
- Does the syntax pass client compilation?
- Does the indicator curve match the report’s figures?
- Do signal positions at key turning points align?
- Are there abnormal values under extreme market conditions (trading halts, limit-up/limit-down)?
4. Efficiency Comparison: From “Weeks” to “Hours”
Under the traditional approach, reproducing a strategy from a complex financial engineering report requires reading the full text, deriving formulas, writing scripts, and debugging iteratively—measured in person-weeks. With the new “LLM + manual validation” workflow:
| Stage | Traditional Approach | LLM-Assisted |
|---|---|---|
| Report reading and definition extraction | Half a day to a full day | Minutes |
| Formula translation and coding | Several days | Minutes (including 1–2 revision rounds) |
| Validation and backtesting | Several days | Still manual, but with a much narrower scope |
| First usable version | 1–2 weeks | Under 1 hour |
For more complex reports (strategies involving multi-factor composition or nonlinear transformations), initial reproduction can likewise be compressed to under an hour. This means researchers can shift their effort from “translation labor” to higher-value work such as strategy evaluation and improvement.
5. An Honest Look at Capability Boundaries
While acknowledging the progress, it is important to be realistic about the gap between current open-source models and top-tier international closed-source models:
- First-attempt success rate: Top closed-source models approach “one-shot success” on complex programming tasks, while open-source models usually still require a few rounds of human feedback;
- Multimodal understanding: For figure-dense or poorly scanned reports, models with strong multimodal capabilities still hold an advantage in information extraction;
- Deep reasoning: In scenarios requiring long chains of mathematical derivation, open-source models occasionally exhibit jumps in intermediate steps.
The most reasonable positioning at this stage is therefore: open-source models can already handle the vast majority of well-structured engineering tasks, and they offer unique value in scenarios involving private deployment, data compliance, and cost control. For industries highly sensitive to data leaving their domain—such as finance—locally deployable open-source solutions, combined with an organization’s own compute or model inference services from general cloud platforms, represent a pragmatic balance between efficiency and compliance.
6. Conclusion
From “being heavily criticized by the community” to “reaching open-source-leading programming capability,” the new generation of open-source LLMs has demonstrated the pace of evolution in the open-source camp within a single version iteration. For quantitative developers, the more important lesson is the shift in working methods: hand the formalizable stages—report comprehension, formula translation, error correction—to the model, and reserve judgment and verification for humans. Once this “each side plays to its strengths” workflow is in place, the barrier to strategy reproduction drops dramatically, and the iteration speed of quantitative research enters a new order of magnitude.
