There's a post on r/Forexstrategy that goes: "I spent about 11 hours kicking code back and forth between Grok, ChatGPT, and the paid version of Claude, to build and rebuild an EA that refuses to compile in MT5."
The replies pile in, because everyone has done the same thing. It's 2026, AI is this good — surely writing a trading bot is one prompt away? So you open ChatGPT, type "write me an MT5 EA that buys when RSI is oversold," paste the result into MetaEditor, hit compile — and stare at a screen full of red errors.
This article answers one question: can AI actually write your EA? Here's the conclusion up front, so you don't burn the same 11 hours.
30-second answer: It writes code, not code that makes money. AI can translate a strategy into MQL5 that compiles, but it cannot tell you whether that strategy has any real edge — and the edge is the entire value of an EA. It writes the syntax. It can't write the edge.
Round one: can it even write an EA that runs?
Yes — but "one prompt, ten minutes" is what the tutorials sell you.
Someone documented one full test (<a href="https://www.mql5.com/en/blogs/post/770331" target="_blank" rel="noopener">a public write-up on mql5.com</a> — note this is a single developer's account, not a statistic): ask ChatGPT to write an MT5 EA, and from first paste to a clean compile took about 35 minutes across 3 rounds of debugging. The first compile threw a wall of errors, the usual kinds:
- an undeclared variable in the position-counting function
- an RSI call using MQL4-style parameters that don't apply in MQL5 (MQL5's
iRSIreturns an indicator handle you then read withCopyBuffer) - a missing semicolon in an order block
- an implicit type-conversion warning in the lot-size math
- a call to
AccountFreeMargin— a function that doesn't exist in MQL5 (it's MQL4; in MQL5 you useAccountInfoDouble(ACCOUNT_MARGIN_FREE))
That last one is the root disease. MQL4 and MQL5 are two different languages with different function names and syntax, and the AI's training data has them mixed together. When it generates code, it's interpolating — sometimes correctly, often not — and it drops MT4 syntax into your MT5 file.
Our team writes MQL5 every day, so these traps are familiar. The honest read on this round: as an accelerator for someone who already knows MQL5, AI is great — boilerplate, comments, debugging errors line by line (line by line being key; paste a whole screen of errors at once and it makes things worse). But for someone who doesn't know the language, it's a tool that confidently writes broken code. A forum regular put it well: "AI generates horrible invalid code, but it does a pretty good job going line by line."
So round one's truth: you can pass it — if you can already read the code. If you can't, those 11 hours are yours to keep.
Round two: it compiled — will it make money?
No. And this is the round no amount of persistence saves you from.
Same documented test, after the clean compile: 12-month backtest, down 4.2% over 87 trades. Undeterred, the author put $200 on a live account for 6 weeks: down 9.4%. (Same single write-up cited above.) Why? Underestimated spread, ignored slippage, broker suffix issues, news spikes blowing through — the real-trading details that, unless you explicitly ask for them, AI often won't handle for you.
But that's not even the root problem. The root problem is one sentence worth remembering:
Ask AI for a bad strategy and it will faithfully implement a bad strategy.
ChatGPT won't stop you. You say "buy when RSI drops below 30," it writes a clean, tidy EA that buys when RSI drops below 30. But it cannot tell you whether "buy when RSI is below 30" actually makes money — that takes trading experience, not coding ability. And whether an EA deserves to exist at all is decided entirely by that judgment.
There's a more telling <a href="https://www.forexfactory.com/thread/1359724" target="_blank" rel="noopener">case on ForexFactory</a>: someone used ChatGPT 4/5 plus Claude, at least 2 hours a day, for a month — describing it as requiring "absolute dogged persistence." The result? An EA that "wasn't profitable but did work."
A month of grinding for something that "works but doesn't profit." That's not AI being too weak. It's you asking it to do something it can't do.
Round three: why an AI-written EA is built to fool you
Even if you get lucky and the backtest curve looks gorgeous — don't celebrate. There are two traps AI is especially prone to, and that you specifically won't see.
Trap one: look-ahead bias. In plain terms: the backtest code peeked at the future. Asking an LLM to write a backtest from scratch is especially prone to this — you have to manually check, line by line, when the signal is generated versus when the fill happens. Why is AI so prone to it? Because it tends to use every column available in the data — including data that didn't actually exist yet at the moment of the decision. The classic version: generating a signal from the current candle's close and assuming you can fill inside that same candle — but that candle's close isn't known until it closes, so you couldn't have ordered at that price. In the backtest you "made a fortune." Live, that price doesn't exist. (Note: generating the signal on the close and filling on the next candle's open is legitimate — the difference is purely the fill timing.)
Trap two: overfitting. There's a classic statistical result: take purely random data — data with no signal in it whatsoever — and with enough parameters and aggressive enough filtering, you can still extract a "strategy" that backtests profitably. Meaning a single pretty backtest curve is not enough to prove a real edge on its own. It might just be you (or the AI) carving a coincidence out of noise. Ruling that out takes out-of-sample testing, walk-forward, and real cost modeling — not a nicer-looking curve.
There's a line on r/algotrading, the kind people only write after blowing an account:
"A lot of people eventually realize they weren't trading strategies — they were trading backtests."
AI makes this trap deeper, because it can hand you a great-looking backtest in seconds — faster than you can think to doubt it. Pair that with the old rule of thumb — "whatever drawdown you see in backtests, expect 2-3x worse live" — and you understand why an AI-written EA that doubled in backtest tends to bleed on a real account.
What about "AI-written EA, 331% in 7 years"?
If you've searched for AI EAs, you've seen the pitch: some AI-generated EA, 7-year return of 331%, 65.9% win rate, profit factor 1.51 — suspiciously precise numbers.
Don't dismiss it outright — but know how to check. The problem isn't the numbers themselves, it's whether they're verifiable:
- A lot of these flashy figures are backtest results, and a backtest can be manufactured into any curve via overfitting and look-ahead bias — so the curve alone tells you nothing;
- Even if a page claims a "verified live signal," look for a public, clickable, independently checkable link (Myfxbook, FXBlue, MQL5 Signals — any of them work). A handful of screenshots with no link you can open is not enough to trust;
- The "AI-powered" label itself is something many traders now treat as a marketing word to be extra wary of — people who actually know EAs ask about the live record first, not the AI content.
So next time you see "AI-powered EA, 331% in 7 years," your first reaction shouldn't be excitement — it should be one question: "Is there a public, clickable live link? Is this live or a backtest?" That single question filters out a big chunk of them. For the full checklist on spotting EA scams, see our <a href="/en/classroom/ea-scam-red-flags">EA scam red flags guide</a>.
So what is AI actually good for?
Don't misread us — we use AI in our own development every day. The point is using it where it works:
Good jobs for AI: translating a strategy you've already thought through into MQL5, writing repetitive boilerplate, debugging compile errors line by line, commenting code, batch-editing parameters. These are execution-layer tasks, and AI is a fine accelerator.
Don't expect AI to: design a strategy, judge whether a strategy has real edge, guarantee profitability, or run a trustworthy backtest on its own. These are judgment-layer tasks, and they take trading experience paid for in real money.
In one line: AI accelerates people who already know what they're doing; it doesn't deal beginners a winning hand. The more you understand trading and MQL5, the more useful it is; the harder you try to use AI to skip learning, the more reliably it hands those 11 hours back to you in the form of an EA that won't compile, or a backtest that lies. For how to judge whether a strategy is worth coding into an EA, see the <a href="/en/classroom/how-to-choose-ea">how to choose an EA guide</a>; if you want to backtest your own, read the <a href="/en/classroom/ea-backtest-guide">backtesting guide</a> first so you don't fall straight into the look-ahead trap.
So: build it yourself, or buy?
Back to the opening question. The part AI can't help you with is exactly the hardest part of the whole thing — verifying whether a strategy actually has an edge.
And there's only one way to verify edge: watch it run on real money, over a long enough time, with a record you can independently check. Which happens to answer the sharpest question in trading — "if it really makes money, why would anyone sell it?"
The answer isn't about who wrote the code (you, the AI, or a developer — doesn't matter). It's about whether the logic has run publicly on Myfxbook, with real money, for long enough. An EA with a two-year live track record and an EA ChatGPT generated in ten minutes with a pretty backtest differ not in code quality, but in four words: tested by reality.
So instead of spending 11 hours on an EA that probably won't compile and whose backtest is lying to you even if it does, the better move is to look at finished products with verifiable live records — and reframe "buying an EA" as "buying an edge that real money has already validated." Every EA in the <a href="/en/products">FXTool catalog</a> runs on live accounts with published results; when we pick, the first thing we look at is the live record and the drawdown, not whose marketing has the highest AI content.
FAQ
Can ChatGPT write an MT4/MT5 EA?
It can write code, but the first compile often errors and usually needs several rounds of debugging, and it readily mixes MQL4 and MQL5 syntax (e.g. using AccountFreeMargin, which doesn't exist in MQL5). It's useful as an accelerator for people who already know MQL5, not as a one-shot solution for beginners.
Can an AI-written EA be profitable? Compiling is not the same as profiting. AI will faithfully implement whatever strategy you give it, but it can't judge whether that strategy has an edge. In publicly documented tests, AI-generated EAs lost money in both backtest and live trading. Profitability is decided by the strategy, not the tool that writes it.
Why does an AI-written EA look great in backtest and lose live? Two reasons: look-ahead bias (AI-written backtest code easily uses future data, like computing a signal from the same candle's close), and overfitting (with enough parameters, even random data "backtests profitably"). Add the fact that AI ignores spread, slippage and news by default, and live results are naturally worse.
Is it worth using AI to learn to write EAs? As a learning tool, yes — it shows you what code looks like and helps debug. But don't treat it as a shortcut around learning to trade. AI accelerates people who know what they're doing; it won't build your trading judgment for you.
Is "AI-powered EA, 331% in 7 years" real? You can't call it true or false on sight, but you can check it: unless it provides a public, clickable, independently verifiable live link (Myfxbook, FXBlue, MQL5 Signals — not a screenshot), it isn't enough to trust. A lot of these numbers come from a backtest that can be faked, and "AI-powered" is a marketing word to be extra wary of in trading circles.
The short version
- AI can write MQL5 that compiles, but the first pass often errors and frequently mixes in MQL4 syntax — you need to be able to read the code
- Compiling ≠ profitable — AI faithfully implements a bad strategy; it can't judge whether a strategy has edge
- AI-written backtests are especially prone to look-ahead bias and overfitting; great backtest, losing live is the norm
- "AI EA, 331% in 7 years" pitches are basically fake — demand a verifiable Myfxbook link
- AI is an accelerator for people who know what they're doing, not a shortcut around learning; buying an EA means buying an edge real money has validated, not buying code
To pick an EA by its live record instead of its marketing, start with the <a href="/en/classroom/how-to-choose-ea">how to choose an EA guide</a>; to spot AI-hype scams, see <a href="/en/classroom/ea-scam-red-flags">EA scam red flags</a>.
Risk disclosure: Trading forex and CFDs on margin carries a high risk of loss and can wipe out all deposited funds. This article is educational content about EA development and selection, not investment advice. Third-party test figures cited are from public sources and provided for reference only.
About the author: The FXTool team builds and tests MetaTrader trading tools daily. We run every EA we sell on live accounts and publish the results. This guide reflects what we've learned from building 50+ EAs and working with thousands of retail traders.