Did you ever try to use AI to build a trading strategy?
Let me guess… It didn't work?
I see from time to time people reporting how bad AI (or LLMs in general) is at trading.
Founding Idea
Months ago I started thinking about how I can help the AI models and steer them into the right direction, so they build good strategies.
And this is what I want to share in this article. I built a system around the models, that does this:
- Execution compiler: Functional correctness of a strategy is verified immediately right after the build. The AI receives immediate feedback about what to fix.
- Immediate feedback: Backtests and logs. The AI receives feedback on how to structure the strategy if there are deadlocks or errors in logic.
- Conceptual feedback: A knowledge hub with a scientific collection of best trading strategies that are proven to work for years, confirmed from reputable sources.
What I've done
I build 2 variants of strategies:
- Asked Claude to build a MT5 Strategy. Then compiled and optimized it.
- Asked a Trading Harness to build a strategy. Then optimized it.
Both results are compared later in this article.
Both variants start from the same prompt. The harness adds the knowledge hub up front and two feedback loops back into the model.
Tools Used
The whole foundation is heavily relying on these tools:
Opus5 + Harness Variant
AI-Backbone.com – implements the harness and supports in building custom strategies with all 3 pillars (compiler, immediate backtest feedback, knowledge hub).
Opus5 + MT5 Variant
- Claude Code – used to build MT5 MQL-Code
- MetaTrader5 used to compile, run and optimize the code from Opus.
Step1: Raw Opus5
For MT5 and AI-Backbone I used very similar prompts to generate the first version of the strategy.
You can download them from here.
Now, this is sadly what most people see when they try "vibe trading" with AI:
Result in MT5
After Opus5 built the MT5 code inside Claude Code, this is the direct result.
MT5 — the first shot, straight out of Claude Code.
Result in AI-Backbone.com
The prompt was here the same. The only difference is that while building the initial strategy code, Opus5 had instructions to build it in Python. The strategy is internally executed via NautilusTrader – a professional open source framework for institutional trading.
The first shot result is however.
AI-Backbone — the first shot, before any optimization.
Step2: Optimization
The initial shots did not look well, because Opus, and none of other AI models, can guess robust market parameters.
So I believe that in order to receive a well working strategy, we need to refine the first draft.
Both environments MT5 and AI-Backbone.com support strategy optimization. In both cases I selected "Recovery Factor" as optimization metric. Recovery factor means: "Final profit"/"Max. Drawdown".
Optimization Results
The best recovery factor that was found in MT5 is 13.8:
MT5 — every optimization pass plotted against recovery factor.
The best recovery factor that was found in AI-Backbone is 19.4
AI-Backbone — the optimizer leaderboard, sorted by r2_gain.
Result Evaluations
Equity Curve
MT5
AI-Backbone
Statistics
MT5
AI-Backbone
Holding Time
MT5
AI-Backbone
PNL Histogram
AI-Backbone — MT5: not available.
Comparison Table
| Strat | Profit | Max. Drawdown | Max Holding Time | Max Loss Streak | Win% | Total Trades | Brokers |
|---|---|---|---|---|---|---|---|
| Opus5+MT5 | $10,300 | $758 | 57h | 6 | 53% | 101 | MT5 Only |
| Opus5+AIBackbone | $13,048 | $672 | 112d | 16 | 13% | 45 | Crypto, Futures, MT5 |
Note: The MT5 variant used 0.01 lots. The AI-Backbone variant used 0.05 lots. This way they produce approximately the same max-drawdown and can be compared. This also means that the risk on the AI-Backbone variant can be reduced, while the MT5 variant can't.
How to choose
- If you have 5k or more, the Opus+MT5 Variant might be best for you
- If you prefer to let runners grow with less capital or smaller risk, then the Opus+AIBackbone variant might be best.
Download the prompt and the MT5 source code here.
Start Building Your Trading Operation
Join the waitlist to get early access and build strategies like this one.
If you want to build a similar strategy, join the wait list and get ahead of the other traders.