TL;DR — the answer box
- Prompt in four narrow passes, not one broad one. Experience and criteria, then the market edge, then exits, then filters.
- Start from a market edge you can name. An unconstrained model invents behaviour that is not there, and sounds identical when it does.
- Ask for exits before you ask for profit. Drawdown is the thing an AI will not volunteer.
- The output is a candidate, never a conclusion. In the companion test, the top 25 in-sample picks lost 85% of their risk-adjusted score out-of-sample.
- The validation step is not optional and it is not part of this page. It is the whole of the companion study.
What this guide is, and what it is not
This is the how. It is the prompting workflow, the order to run it in, and the four screenshots of the actual prompts.
It is deliberately not the evidence that AI-generated strategies work, because I tested that separately and the answer does not fit in a how-to. If what you want is the verdict — how many survive, by how much they degrade, what beats them — read Can AI Build a Profitable Trading Strategy? instead. That study swept 2,304 variants and implemented 5 AI-written rule-sets verbatim.
I am separating them on purpose. A guide that teaches a workflow and also grades it tends to grade it generously.
Step 1 — Start from a market edge, not from a prompt
A market edge is a specific, repeatable behaviour you have a reason to believe in. US index ETFs tending to bounce after several consecutive lower closes is an edge. "Find me something profitable" is not.
This matters more than any prompt wording. An AI asked to search everything will produce a confident, well-structured strategy for a behaviour that does not exist — and it reads exactly like one for a behaviour that does. Naming the edge first converts the model's job from open-ended search into filling in the details of an idea you can already defend.
Step 2 — Set the experience level and the criteria
Telling the model who it is talking to changes the density of the answer. Telling it the criteria — instrument, direction, holding period, what counts as acceptable — stops it hedging across every possibility.
Step 3 — Name the edge in the prompt itself
Here the edge from Step 1 goes in as a constraint: a mean-reversion, long-only approach on the S&P 500. Everything the model returns from this point sits inside that box. It is also the cheapest place to be wrong: in the companion test only 50% of the 2,068 eligible variants were still profitable out of sample, which is a coin flip, and no amount of prompt refinement rescues a behaviour that was never there.
Step 4 — Ask for exits, and ask for several
This is the prompt most people skip. Ask for entries and an AI will give you entries; drawdown is not something it volunteers. Asking for several exits also gives you something to compare, which matters later — a strategy whose result changes wildly depending on which exit you pick was never robust to begin with.
Step 5 — Ask for filters that remove trades
A filter should take trades away. Framing the request that way tends to produce a single meaningful condition — in this example an Internal Bar Strength threshold — rather than a stack of indicators that each remove a handful of trades and collectively fit the past. Sample size is the reason to care: the companion study would not even score a variant on fewer than 30 in-sample trades, and 236 of its 2,304 variants failed that bar before any result was read.
What the output actually looks like
Run those four prompts on a defined edge and you get something concrete enough to test. In this case:
- Market: S&P 500
- Entry: 3 lower closes within 4 bars
- Exit 1: RSI(2) above 65
- Exit 2: after 4 bars
- Filter: Internal Bar Strength below 0.2
Tested over 18+ years of daily data, that produces this:
Read that chart carefully, because it is the exact shape that fools people. It rises. It has no benchmark line on it. It has no random-entry control on it. Nothing about it tells you whether this strategy beat simply owning the index over the same 18 years, and nothing about it tells you whether a search of similar rules would have produced an equally pretty curve by chance.
I am leaving the chart on this page because it is honest about what the workflow produces. What it is not is evidence that the workflow produces something that works.
The step this page does not cover, and you cannot skip
Everything above gets you a candidate. Whether the candidate is real is a separate question, and I tested it properly rather than asserting it:
- 0 of 2,068 eligible optimized variants beat buy-and-hold out-of-sample. Not the best one. None of them.
- The top 25 in-sample picks lost 85% of their risk-adjusted score when tested on data they had never seen.
- Only 50% of eligible variants were still profitable out-of-sample — a coin flip.
- Of 5 AI-written rule-sets implemented verbatim, 1 passed a Monte Carlo screen for a genuine edge.
- Buy-and-hold on the same window returned $87,835 on a $35,000 account.
Those numbers are not measured on this page and they are not mine to summarise loosely — every one comes from the companion study, which is where the method, the controls and the full tables live.
The practical consequence for this workflow: treat the AI's output the way you would treat a strategy a stranger emailed you. Split your data before you start, keep a slice the strategy has never touched, and compare the result to owning the index rather than to zero.
Where AI actually goes wrong
Hallucinated behaviour. The model will describe an indicator doing something the real calculation does not do, in fluent and specific language. Ask it to restate the rule in plain English, then re-derive the indicator yourself before trusting any curve.
Silent code errors. If you ask for code, expect logic bugs that do not throw — a lookahead in the fill, an off-by-one in the bar index. Both produce a backtest that runs cleanly and reports a number that never happened.
Overfitting, which is not an AI problem. This is worth being precise about, because it is where this page used to overlap with the study. Curve-fitting is what any optimizer does when nothing stops it, human or machine. The AI just does it faster and describes the result more persuasively. The defence is the same as it has always been: out-of-sample testing, walk-forward analysis, and comparing against a control that has no edge in it. The companion study measures exactly how much damage it does.
If you want a defined market edge to prompt from rather than inventing one, and a testing framework to check what comes back, that is what the Algo Trading Masterclass is built around. Every study behind this workflow — including the one that grades it — is published in full at StatOasis.com/Overfit
Methodology & risk note: This article runs no backtest of its own. The worked example is a single S&P 500 strategy produced by the prompts shown and tested on 18+ years of daily data in 2025; it carries no benchmark and no control, and is presented as an illustration of output shape rather than as a result. Every quantitative claim about whether AI-generated strategies survive testing is inherited from the companion study on SPY daily OHLCV, 1993-02-02 to 2026-06-12: 2,304 variants swept, 2,068 eligible at 30+ in-sample trades, in-sample to 2016-06-03 and out-of-sample from 2016-06-06, $35,000 starting capital, flat-only with no compounding, frictionless, next-open fills, measured against buy-and-hold and a seeded random-entry control. All results are historical and for educational purposes only. Past performance does not guarantee future results. Not investment advice.






