Ask an AI to “create a profitable strategy” and it will happily comply — that is precisely the problem. This article looks at what happens when machines search for trading rules automatically: what the classic genetic-programming experiments found, why the search itself manufactures false discoveries, and how researchers measure the probability that a beautiful backtest is an artefact. By the end, you will be able to interrogate any machine-generated strategy — including one you generate yourself — the way the literature does.
Prerequisite: the advanced articles — especially “Overfitting: How Curve-Fitting Hides in Reasonable Choices”, and “Designing a Backtest That Can Actually Falsify Your Idea”. This article applies those ideas to automated search.
Key points
• Machines have been writing trading rules since the 1990s. The classic genetic-programming study found rules with genuine predictive content — and a Federal Reserve re-examination found no risk-adjusted outperformance of simply buying and holding.
• The danger scales with the search. Trying more configurations mechanically raises the chance that the best one is a fluke: this is the territory of overfitting and data snooping.
• The correction methods exist and are usable: judge the winner against the whole universe of rules tried (White’s Reality Check), raise the significance bar when many things were tested, and estimate the Probability of Backtest Overfitting (PBO) before believing a result.
• If AI assistance enlarges the search — more variants, tried faster — it enlarges the false-discovery problem with it, unless the testing discipline grows too.
• A machine-generated strategy is a hypothesis, not a product. It earns trust only by surviving tests it was not designed to pass.
Start trading with Exness
You can open an account here:
In plain words
Machines have been writing trading rules since the 1990s, and the catch is built into the search itself: if you test thousands of rules on the same old data, the best-looking one can be a fluke even when every rule is pure noise. The classic genetic-programming experiment did find rules with real predictive content, but a re-check found no risk-adjusted outperformance over simply buying and holding. Researchers therefore grade a machine-made winner against the whole field it beat — one famous check ran 7,846 versions of classic rules — and in one worked example the chance that the winning backtest was overfit came out at about 55%. So treat any AI-built strategy as a guess, not a product: it only earns trust by passing tests on data the search never touched, with full trading costs charged.
1. What “AI builds the strategy” actually means
There are three distinct things sold under this label, and they fail in different ways:
- Automated search over rules. A genetic algorithm or genetic programming system generates many candidate rules — combinations of indicators, thresholds and conditions — tests each on historical data, keeps the winners, mutates and recombines them, and repeats. The human supplies the ingredients and the fitness score; the machine supplies the patience.
- Parameter optimisation. A human-designed strategy whose numbers (periods, thresholds, stop distances) are tuned by brute force or by an optimiser until the backtest peaks. This is automated search over a smaller space, with the same failure mode.
- A language model writing strategy code. You describe an idea to an LLM; it produces an EA or a script implementing it, with plausible-looking parameters already filled in. The code may be competent. Treat the parameters as untested unless you have verified their supporting evidence and its relevance to your market: whether they have ever been tested on your market is a question you have to answer yourself, by testing them.
The first — automated rule search — has a research record reaching back to the 1999 genetic-algorithm study examined in the next section, which the next section reads. The third is newer, and the companion article on LLMs and technical analysis covers what LLMs are and are not good at; the short version is that fluent code is not evidence about a market.
2. The classic experiment: genetic programming versus buy-and-hold
In 1999, Franklin Allen and Risto Karjalainen published the study this field still cites. They used a genetic algorithm to learn technical trading rules for the S&P composite index. The result was genuinely two-sided. In their main out-of-sample window (1970–89), the evolved rules identified periods to be in the index when returns were positive and volatility low, and produced positive excess returns over buy-and-hold after transaction costs. But when they ran the same rules over other periods reaching back to 1929, the rules still identified favourable periods yet did not produce excess returns after transaction costs (Allen & Karjalainen, 1999).
A Federal Reserve Bank of St. Louis comment then asked the question the first paper had left open: were the returns compensation for risk? Christopher Neely re-examined the rules on a risk-adjusted basis and found no evidence that they outperformed buy-and-hold once risk was accounted for — a result he describes as consistent with market efficiency (Neely, 1999).
Hold both halves of that story, because each half alone is a sales pitch. “A genetic algorithm beat buy-and-hold after costs” is true — in one window, before risk adjustment. “On re-examination there was no evidence of outperformance after risk adjustment, and the other periods produced no excess returns” is the fuller version. Automated search found something — the rules had predictive content — but the distance between “some predictive content in some windows” and “a strategy you can run” is exactly the distance this article is about. The next section explains why the search itself inflates that distance.
3. Why the search manufactures winners
Imagine twenty strategies that are all pure noise — coin flips dressed as rules. Test them all, and the best of the twenty can easily look better than chance. Test eight thousand, and the best can look spectacular. Nothing about the winner changed; the size of the field did. This is the selection effect, and it has two names in the literature:
- Overfitting is what happens when a model or a search is tuned until it fits one dataset’s noise along with its signal. The advanced article on overfitting covers the mechanics.
- Data snooping is the same selection problem at the level of a dataset: data reused for inference so many times — by you, by other researchers, by decades of published trial and error — that “discoveries” in it are partly discoveries about that dataset’s accidents.
Bailey, Borwein, López de Prado and Zhu proved the uncomfortable core of this mathematically: high simulated performance is easily achievable after backtesting a relatively small number of alternative configurations, and the probability that the backtest is overfit rises with the number of configurations tried. Under memory effects, an overfit strategy’s expected out-of-sample return is not zero but negative (Bailey et al., 2014).
Now add AI. A genetic programming system can test many configurations in a single run. An LLM-assisted workflow can generate and test strategy variants in large numbers. However cheap the search becomes, the selection problem does not shrink with it. The safeguards in the next section exist because selection effects grow with the search — and searching is now easy.
4. The corrections: how researchers grade a machine-made winner
The literature does not say “never search”. It says: grade the winner as a winner of that search, using tools built for the purpose.
Judge the winner against the whole universe. Sullivan, Timmermann and White took the famous technical-rules study of Brock, Lakonishok and LeBaron and tested an expanded universe of 7,846 parameterisations of filter, moving-average, support-and-resistance, channel-breakout and on-balance-volume rules — then applied White’s Reality Check bootstrap, which asks how the best real rule compares with the best rules found in resampled price histories generated under the assumption that no rule beats the benchmark. On the original sample (1897–1986), the best rule survived even that correction. On the following decade (1987–1996), there was scant evidence it outperformed at all (Sullivan, Timmermann & White, 1999). Both halves matter: snooping correction is not a machine for saying no — it is a machine for knowing which yeses are load-bearing, and out-of-sample time remains the final examiner.
Raise the bar when many things were tested. Harvey, Liu and Zhu catalogued 316 published factors claimed to predict stock returns and showed that, given how much testing the field had done, the conventional significance threshold (a t-statistic of 2.0) was far too lenient; a new factor should clear roughly 3.0. Their point generalises beyond factors: the more strategies you (or everyone before you) tried on this data, the stronger the evidence you must demand from the survivor (Harvey, Liu & Zhu, 2016).
Estimate the probability the backtest itself is overfit. Bailey and co-authors’ PBO framework does this directly. Using combinatorially symmetric cross-validation (CSCV) — repeatedly splitting the data into halves, selecting the best configuration on one half, and checking where it ranks on the other — PBO estimates the probability that your selection procedure picks configurations that fall into the bottom half out of sample. In their worked example on a random-walk series, the selection procedure — whose winning configurations showed in-sample Sharpe ratios between 1 and 2.2 — came with an estimated PBO of about 55% — the in-sample winner fell into the bottom half out of sample more often than not — behind a backtest that looked excellent (Bailey et al., 2015).
Keep the accounting honest. Count all the configurations tried — including the ones you discarded informally, the parameter you nudged “just to see”, and the variants the AI suggested before the one you kept. A search log you could not publish in full is a search whose winner you cannot honestly evaluate. The advanced article on costs in the backtest covers the other half of honest accounting: putting realistic spread, swap, slippage and commission into the test itself.

5. A working protocol for AI-generated strategies
If you use AI to generate or tune strategies, the literature implies a protocol, not a prohibition:
- Write the search space down before you search. Which rules, which parameters, which ranges. A space defined in advance can be corrected for; a space that grew by wandering is far harder to reconstruct — and an incomplete record makes the appropriate correction harder, and can prevent a particular correction from being applied at all.
- Reserve data the search never touches. A final hold-out period, used once. If the winner fails there, that is strong evidence against the strategy as tested — and the response is not “search again with the hold-out included”, which converts it into training data.
- Grade the winner against the field. At minimum, report how many configurations were tried alongside the winner’s score. Where you can, apply the spirit of the Reality Check: would a search of this size, on noise, produce a winner this good?
- Charge full costs. Spread and commission at your account’s actual values, swap where the strategy holds positions over rollover, and realistic assumptions for costs such as slippage that cannot be known in advance, at the strategy’s actual frequency (see the article on costs in the backtest).
- Prefer the strategy you can explain. A rule whose logic you can state in one sentence — and whose failure conditions you can name — may be easier to monitor: its assumptions are visible. A many-condition evolved rule may be harder to diagnose when it stops working. Complexity is a liability you accept for evidence, not a feature.
- Paper-trade forward. Future data was, by construction, unavailable when the rule was selected. A forward run on a demo account is a genuine out-of-sample test — provided the rule is fixed before the run and the results are not repeatedly used to re-tune it: the data it faces did not exist when the rule was chosen.
None of this makes a generated strategy good. It gives a bad strategy the chance to reveal itself in testing rather than in live trading — which is most of the value on offer.
Summary — what to take away
• Automated strategy search is thirty years old. One influential early experiment found rules that identified favourable periods in its main window and in other periods, but produced excess returns after costs only in the main window, and showed no evidence of risk-adjusted outperformance on re-examination.
• The search itself manufactures winners: the more configurations tried, the higher the probability the best is a fluke. This is provable, and automated tools can make the search vastly larger.
• The corrections are known: judge the winner against the whole universe tried, raise the significance bar with the number of tests, estimate the probability of backtest overfitting, and charge full costs.
• Treat every machine-generated strategy as a hypothesis. It earns trust only from tests it was not designed to pass — above all, untouched data and forward time.
Next reads
- Designing a Backtest That Can Actually Falsify Your Idea — the test architecture this article’s protocol assumes.
- Walk-Forward Analysis: Rolling Windows in Practice — the rolling out-of-sample method for strategies that must be re-estimated as time passes.
- Costs in the Backtest: Spread, Swap, Slippage and Commission Assumptions — the cost accounting a generated strategy must survive.
- Can AI Predict the Market? What Machine Learning Research Actually Shows About Price Prediction — the prediction side of the same evidence.
FAQ
Q: ChatGPT wrote me an EA in five minutes. Is that the same as the genetic programming in this article?
A: No, and the difference matters. Genetic programming searches: it can test many rules against data and select by measured performance — which creates the selection problem this article describes. An LLM writes: it produces code from patterns in its training text, and the parameters it proposes should be treated as untested on your market — and their supporting evidence checked — until you have tested them yourself. The EA may implement your idea correctly, but the fluency of the code is not evidence for its numbers, or for their relevance to your market. It still needs the full protocol of Section 5 — and the companion article on LLMs and technical analysis covers what LLMs do well and badly in this role.
Q: If I only test a handful of strategies, is data snooping still a problem?
A: Less of one — the correction scales with the number of trials. But remember the collective version: the handful you chose may have been influenced by what the field already published about this same data — prior research can shape which candidates get tried, and that inherited selection is part of the context in which the winner should be judged. Sullivan, Timmermann and White’s point is that the winner must be judged against the full universe it was selected from — and Harvey, Liu and Zhu’s work implies that the universe effectively includes the search history you inherited, not only the one you ran yourself.
Q: What PBO number should I accept?
A: PBO estimates how often the in-sample winner falls into the bottom half out of sample. A PBO near one half means the in-sample winner falls into the bottom half out of sample about half the time; a higher estimate means it does so more often. There is no magic safe threshold; there is a direction — a lower estimated PBO indicates less selection instability by this measure, and a higher one is a warning. Neither, by itself, establishes profitability.
Q: Is optimisation ever legitimate?
A: Yes — choosing between two or three economically motivated parameter values, on a written-down search space, with a hold-out and full costs, is normal strategy development. Tuning at any scale can introduce selection bias — Section 3 cites work showing high simulated performance arising after a relatively small number of configurations — and the risk grows with the number tried. The reporting failure is presenting the winner as if it had been the only candidate.
Sources: Allen, F. & Karjalainen, R. (1999), “Using Genetic Algorithms to Find Technical Trading Rules”, Journal of Financial Economics 51(2); Neely, C. J. (1999), “Using Genetic Algorithms to Find Technical Trading Rules: A Comment on Risk Adjustment”, Federal Reserve Bank of St. Louis Working Paper 99-015A; Sullivan, R., Timmermann, A. & White, H. (1999), “Data-Snooping, Technical Trading Rule Performance, and the Bootstrap”, The Journal of Finance 54(5); Bailey, D. H., Borwein, J. M., López de Prado, M. & Zhu, Q. J. (2014), “Pseudo-Mathematics and Financial Charlatanism”, Notices of the American Mathematical Society 61(5); Bailey, D. H. et al. (2015), “The Probability of Backtest Overfitting”, Journal of Computational Finance 19(2); Harvey, C. R., Liu, Y. & Zhu, H. (2016), “…and the Cross-Section of Expected Returns”, The Review of Financial Studies 29(1). Checked: 21 November 2026.
This article is information only and is not investment advice. Forex and CFD trading involves a substantial risk of loss, including the possibility of losing more than you deposited with some account types and jurisdictions. A demo account can be used to practise the procedures in this series without placing live trades. Make sure you fully understand how leveraged products work before you consider trading with real money.
Disclosure: Broker Cost Check is reader-supported. If you open an account through a partner link on this page and trade, Exness pays us a share of the revenue from your trading activity under its partner programme. You pay us nothing: our payment comes from Exness, out of that revenue. How we make money: How Broker Cost Check works — method and how we make money

Leave a Reply