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
Here are the prompts I used:
Download the prompts and the full source code from here.
Now, this is sadly what most people see when they try "vibe trading" with AI:
First Shot 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.
First Shot 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.
So these bad results is what people usually experience after they give AI the task to write "a profitable strategy". But I didn't stop here.
Continue reading to see what I've discovered.
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 recovery factor.
Result Evaluations
Equity Curve

MT5 and AI-Backbone equity curves.
While the MT5 variant has more trades with smaller profits, the AI-Backbone seems to have found a strategy that can catch big moves.
Statistics

MT5

AI-Backbone
Holding Time
MetaTrader 5 scatter plot of profit against position holding time in hours.

AI-Backbone scatter plot of closed profit and loss against open duration in days.
PNL Histogram
AI-Backbone histogram of closed trade results. This feature is not available in MT5.
Comparison Table
| 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.
So both results are great. You can try out both - just download the prompts, the source code and see how it works for you.
Download the prompt and the MT5 source code here.





