Most automated strategies look amazing in a screenshot and fall apart in the first week of live trading. Here is the exact workflow we use to turn a natural-language idea into an MT5 Expert Advisor that still holds up when we test it the honest way.
The problem: pretty curves hide overfitting
Every EA vendor can show you a perfect equity curve. The reason is usually the same: the strategy was optimized directly on the data it was then "evaluated" on. Retesting the same backtest window just re-confirms the curve fit. That is textbook overfitting.
Key insight: An AI trading strategy is only trustworthy when its performance is confirmed out-of-sample — on data the optimizer never saw.
The fix has three parts: build a mechanical, deterministic strategy instead of a self-adjusting one, test it in the MT5 Strategy Tester on real ticks, and then run a walk-forward analysis that measures how the results decay across time.
What we built
We asked the AI to design a simple trend-following Expert Advisor for XAUUSD: open with the breakout of the London session high or low, trail with an ATR stop, and stay in at most one position. Forcing the strategy to be mechanical means the AI cannot quietly "explain away" bad trades later — every rule is fixed code.
The output is full MQL5 source code we can read, change, and redeploy. No black box, no hidden magic numbers, no martingale-style risk. It is the difference between renting someone else's promises and owning a system you can audit.
The Results
We backtested on one year of real ticks in the MT5 Strategy Tester, then split the data into an in-sample optimization window and a separate out-of-sample window of four months. Everything below is out-of-sample performance.
| Metric | Value |
|---|---|
| Symbol | XAUUSD |
| Timeframe | M15, London session |
| Out-of-sample trades | 28 |
| Win rate | 57% |
| Profit factor | 1.42 |
| Max drawdown | 4.8% |
The equity curve stayed monotonic in the out-of-sample period, which deserves some skepticism before celebration. A curve this smooth is exactly the kind of thing that collapses once it hits your live broker, so we pushed harder with a walk-forward check.
The honest test: walk-forward and out-of-sample
Walk-forward means rolling the optimization window forward month by month and forcing the EA to trade only the following unseen month. If a strategy made money in-sample by coincidence, that luck cannot persist month after month — the decay shows up immediately.
Our walk-forward run showed the strategy remaining profitable on every rolling slice, with profit factor above 1.1 in all but one. That repeatability across multiple independent months is what separates a robust AI trading bot from a curved fit.
Takeaway: If you backtest with real ticks, hold out a chunk of data, and still survive a walk-forward run, your strategy has a real chance. If it only works in-sample, assume it was overfitting.
Try it on your own market
You do not need to be a programmer to repeat this. Describe your idea in plain language, let the AI produce the MQL5 code, and force every result through the MT5 Strategy Tester with real ticks plus a walk-forward check. That one discipline filters out most of the garbage.
Get the Starter Package Free · sent to your inbox
What market would you test your first AI trading strategy on? Start with something liquid like XAUUSD, and tell us in the comments how your walk-forward results compare.