Jul 12
The Agentic Turn: How I Build Trading Strategies From a Single Sentence
For most of the history of systematic trading, building a strategy has been slow, manual work. You open a platform, drag an indicator onto a chart, wire a condition, set a stop, and repeat — a hundred times — until you have something worth backtesting. Or you run a brute-force search that spits out thousands of half-finished scaffolds, and you spend your evenings deciding which of them are real. Either way, the bottleneck is you.
For the past few months I have been building the layer that removes that bottleneck. Not another indicator, not another optimiser preset — a framework for agentic strategy development: a set of AI agents that turn a plain-English trading idea into a finished, working StrategyQuant X strategy, and a live oracle that verifies every single one against a running platform before it is allowed to count.
This is the most ambitious thing I have built, and I think it is a preview of where the whole field is going. Let me show you how it works.
In the interest of full disclosure: the StrategyQuant links in this article are affiliate links — if you start there through them I may earn a commission, at no extra cost to you. It changes nothing about how the tools below work.
Generation is cheap. Verification is everything.
Here is the uncomfortable truth about large language models and trading: generating a strategy that looks right is trivial. Ask any modern model for “a mean-reversion system on EURUSD” and it will confidently produce something plausible. Ask it to produce a hundred, and it will. The problem is that a large fraction of them will be subtly, invisibly broken — an indicator that does not exist in your platform, an operator combination the engine cannot compile, a shape that reads beautifully in English and means nothing to a backtester.
So the interesting engineering problem was never generation. It was verification. A framework that generates a thousand plausible strategies is a liability. A framework that generates a thousand strategies and can prove which ones are real is an edge.
That single idea — an AI proposes, but nothing is trusted until the platform itself accepts it — is the spine of everything that follows.
Describe a strategy in a sentence
The entry point is a builder agent. You describe what you want in ordinary language:
Long when EMA(20) crosses above EMA(50), 30-pip stop, 60-pip target.
A purpose-built agent — I call it the sqx-builder — takes that sentence and does something most “AI strategy” demos skip entirely: it reads your StrategyQuant installation first. It builds a private catalogue of every indicator, operator and custom block you actually have, and resolves each part of your idea against that catalogue. Then it fills a proven strategy skeleton with concrete rules and packages a loadable .sqx file.
The output is not a template with holes for you to fill in later. It is a finished strategy — every rule, every parameter, concrete — that opens in StrategyQuant X and backtests as-is. The example above becomes EURUSD_EMA_Cross.sqx, ready to load, in well under a minute.
That “reads your install first” step matters more than it sounds. It is the difference between an AI that hallucinates a beautiful strategy using indicators you do not own, and one that will only ever hand you something your platform can actually run.
The oracle: an AI proposes, StrategyQuant disposes
This is the piece I am proudest of, and the piece that makes the rest trustworthy.
Every strategy the agent builds is loaded into a running StrategyQuant over its local REST interface. The platform parses the strategy file and either accepts it or rejects it. When it accepts, the agent reports a LOAD PASS. That pass is not a promise or a self-assessment from the model — it is proof from the platform itself that the strategy is structurally real. Bad atoms, unbuildable shapes, malformed logic: all of it gets caught here, at the door, before a single second of backtesting is wasted on a strategy that was never going to run.
I call this the strategy oracle, and it is the honesty mechanism of the whole framework. An AI can be wrong in a thousand confident ways. StrategyQuant cannot be talked into loading a strategy that does not compile. So I let the platform be the judge.
The oracle is now growing a second stage. Beyond confirming a strategy loads, it is learning to drive StrategyQuant’s retester headlessly — running the backtest and reading back the real trades and statistics (trades 211 · profit factor 1.85 · net 4,672) with no browser and no clicking. A load oracle tells you a strategy is real. A trade oracle tells you whether it is any good. That is the direction of travel.
Not just strategies — the whole vocabulary
A strategy is built from smaller parts, and the framework builds those too. Alongside the strategy builder is a suite of authoring skills, each one turning natural language into a different import-ready StrategyQuant artifact:
- Custom blocks. “A trailing stop two ATRs under the Hull moving average” becomes a validated, import-ready AlgoWizard custom block — built from the indicators your install actually has.
- Random groups. “A Value group of EMA, KAMA and ATR periods” becomes the curated menu a builder draws one item from per strategy, to fill a slot in its search.
- Strategy templates. “Breakouts only in the trend direction, session-gated” becomes a ready-to-import builder template — the scaffold a search fills in — with a real, falsifiable entry thesis behind it.
The chain runs block → group → template → project, and every link is install-aware and self-validating. You are not just generating strategies; you are generating the entire vocabulary a strategy builder samples from, in your own words. Many of these are already published in the StrategyQuant Codebase for anyone to use.
Measured, not claimed
This is the part where most “AI for trading” pitches lose credibility, and where I try to earn it back with numbers.
The framework is wrapped in an evaluation harness that is, frankly, more rigorous than the framework itself. It runs the agent headlessly, gates correctness by loading each build into a live StrategyQuant, checks the resulting strategy XML actually contains the shape that was asked for, and denoises every measurement across three passes with held-out, out-of-sample prompts.
The results I am willing to stand behind:
- On a corpus of 30 unseen, real-user prompts, the builder produced 30 out of 30 strategies that loaded into StrategyQuant, single-pass, at a median of about 47 seconds each.
- In a breadth stress-test, 100 out of 100 built strategies traded, with zero logic failures.
- When I turned the same rigor on the agent itself and optimised it, I cut its cost by 37% with zero loss of correctness — and, tellingly, the gains held up better on out-of-sample prompts than on the ones I tuned against. They generalised; they were not overfit to my test set.
And because honesty cuts both ways, the framework keeps an explicit list of what it cannot build yet — multi-tier profit ladders, cross-symbol filters, in-logic position scaling — rather than papering over its edges. A tool that tells you where it stops is one you can actually trust inside its boundaries.
What I’m building now: the strategy factory
Everything above is shipped and working. The frontier — the thing I am building right now — ties it all together into a single automated loop I think of as a strategy factory.
The idea is this. You start not with a strategy but with a hypothesis — a market claim, written down before any code runs. The skills author the template and the groups that express it. The oracle confirms they load. Then a grid of around ten thousand strategies is generated from that template across multiple instruments, and the entire population is judged — not on its luckiest offspring, but on out-of-sample statistics that are hard to fool: the Deflated Sharpe Ratio and the Probability of Backtest Overfitting. The template earns a verdict — graduate, revise, or kill — and that verdict goes back onto the hypothesis card.
A template is judged as a population, never by its best offspring.
That one rule is the whole anti-overfitting philosophy of the factory in a sentence. It is the same discipline I have written about for years — what a million-plus FX strategies taught me about overfitting, and why robustness testing matters more than a pretty backtest — but now wired into an automated pipeline that applies it at scale, without me in the loop for every decision.
I want to be precise about status, because I hold my own work to the standard I hold everyone else’s: the builder, the oracle, and the authoring skills are shipped and measured. The fully-automated hypothesis-to-graduated-template factory is scaffolded and in active development — the vision, taking shape, not a finished product I am selling you today.
The direction of the whole field
For a long time, an edge in this business meant a clever indicator or a well-tuned parameter set. I think that era is ending. When anyone can generate a thousand strategies with a sentence, the generation stops being the edge. The edge becomes the system — the one that can generate, verify, and honestly judge thousands of strategies faster and more truthfully than anyone hand-wiring them one at a time.
That is what I am building. It runs on StrategyQuant X, it is grounded in fifteen years of doing this the slow way first, and every piece of it is answerable to the same question: not “does it look right?” but “did the platform accept it, and does the population hold up?”
If you want strategies built this way — or you want to bring this kind of agentic capability into your own trading or your desk — that is exactly the work I do.