Search YouTube right now: “ChatGPT writes MT5 EA in 10 minutes.” Hundreds of videos. Every one of them ends with the EA appearing on a chart. Almost none of them show what happens when you actually run the EA on a live account. So I did. This is the real result, with the real code, and the real reasons most of those tutorials are misleading you.
The question 8,000 traders search every month — and almost nobody answers honestly
The question “can ChatGPT write an MT5 EA” gets thousands of monthly searches on Google. Often paired with “with telegram integration” or “for free” or “automatically.”
The implicit hope behind the search is: can I skip learning MQL5, get an AI to build my EA, and start trading?
The honest answer, after testing it properly with a live account: partially yes, but not in the way the tutorials promise.
I ran the experiment. I gave ChatGPT a clear prompt asking for a complete, working MT5 Expert Advisor. I copied the code into MetaEditor, compiled it, fixed the errors, ran it on a backtest, then on a demo, then on a small live account. Each step revealed something the YouTube version of this story conveniently skips.
If you’ve been thinking about doing this, save yourself the API costs and the broker headaches. Read this first.
The exact prompt I used
I asked ChatGPT (GPT-5.5 model) for a simple but realistic EA. The prompt was deliberate — specific enough to get usable code, generic enough that any trader could replicate the experiment:
“Write a complete MT5 Expert Advisor in MQL5 that trades EURUSD on M15. Entry rules: buy when RSI(14) crosses above 30 from oversold, sell when RSI crosses below 70 from overbought. Stop loss 30 pips, take profit 60 pips, fixed lot size 0.01. Include input parameters for risk %, magic number, and broker suffix support. Include OnTick() logic, OnInit() initialization, and proper position management. Provide compiling, ready-to-paste code.”
That’s a real EA spec — boring strategy, but a complete one. RSI mean-reversion is one of the most-tested ideas in retail trading. If ChatGPT can’t get this right, it can’t get anything more complex right.
Step 1: ChatGPT generates ~150 lines of MQL5
The output came in clean. Proper MQL5 structure: OnInit(), OnTick(), OnDeinit(). Includes for <TradeTrade.mqh>. Input variables for risk percentage, lot size, magic number, broker suffix. RSI handle initialization, position checks, order execution via CTrade.
At first glance: looks great. Looks like the kind of EA you’d buy on MQL5 for $30.
Then I tried to compile it.
Step 2: Compile errors that reveal the real limitation
First compile attempt: 3 errors, 2 warnings.
Specifics:
- An undeclared variable in the position-counting function
- A wrong parameter type passed to
iRSI(used a deprecated signature) - A missing semicolon in the order block
- A warning about implicit conversion in lot size calculation
- A warning about uninitialized return value in one of the helper functions
This is what every “ChatGPT writes EA” tutorial conveniently skips. The first compile is rarely clean. ChatGPT trained on a mix of MQL4 and MQL5 code, plus blog posts, plus Stack Overflow answers, plus forum threads — many of which contain outdated or wrong syntax. The model interpolates. Sometimes it interpolates correctly. Often it doesn’t.
I went back to ChatGPT, pasted the errors, asked for fixes. Got fixes. Compiled again. Two more errors I hadn’t seen before — the fix had introduced new bugs. Three rounds of debugging later, the EA compiled.
Time spent so far: about 35 minutes. Not the “10 minutes” the tutorials promise. And I already knew MQL5 syntax well enough to verify the fixes were correct. A trader without MQL5 knowledge would have been stuck at iteration 2.
Step 3: Backtest results, before and after the obvious bugs
The compiled EA ran on the strategy tester. EURUSD M15, 12 months of data, 99% modeling quality.
First backtest: EA traded twice in 12 months.
The reason: ChatGPT had set the RSI cross-detection logic in a way that required a very specific tick-by-tick condition almost never met in practice. The signal was triggering on candle close in the spec, but the implementation was checking the wrong array index — comparing the current value to itself rather than the previous value.
This is a subtle bug. The code looks correct. It compiles. It runs. It just barely ever trades.
Round 4 of debugging. Got the bug fixed. Backtest again: EA traded 87 times in 12 months. Result: net loss of 4.2%.
Honest assessment: that’s not a disaster. RSI mean reversion on EURUSD M15 isn’t a great strategy in modern markets — most of the easy edges in that approach were arbitraged out years ago. So a 4.2% loss over 12 months is roughly what you’d expect from an honest implementation of a weak strategy.
The lesson isn’t “ChatGPT wrote a bad EA.” The lesson is: ChatGPT wrote a correct implementation of a strategy that doesn’t work, and then you ran it. The intelligence to catch that the strategy itself was the problem — not the code — is the part ChatGPT can’t supply.
Related reads if you’re going down this path
If this experiment was useful, these go deeper on different parts of the same problem:
- How to actually connect MT5 to ChatGPT (the integration guide) — if you want the technical setup of an LLM-driven EA from scratch.
- The system prompt that actually works for trading decisions — most “trade with ChatGPT” attempts fail because the prompt is wrong.
- Alpha Pulse AI: 105 trades honest review — what an LLM-driven EA actually looks like in production with public Myfxbook.
FAQ
Can ChatGPT really write an MT5 EA?
Yes, ChatGPT can generate MQL5 code for an MT5 Expert Advisor. The compiled output is structurally valid most of the time. Whether the EA actually trades profitably depends entirely on the strategy you specified, not on ChatGPT’s coding ability. Strategy is the hard part; code is the easy part.
How long does it take to get a compiling EA from ChatGPT?
In my test, about 35 minutes including 3 rounds of debugging compile errors. If you have no MQL5 knowledge, expect 1-2 hours per iteration because you can’t easily verify the AI’s fixes. If you know MQL5 well, ChatGPT is more like a fast typist than a senior coder.
Will ChatGPT’s EA make money?
It depends entirely on the strategy you specified. ChatGPT will write whatever you ask. If you ask for a known-bad strategy, you’ll get a faithful implementation of a known-bad strategy. The AI doesn’t validate trading logic — it implements code.
What about ChatGPT MT5 EA with Telegram integration?
Same answer. ChatGPT can absolutely add a Telegram notification layer using the standard MT5 WebRequest function. The integration code works. Whether the EA’s trades are worth telling Telegram about is the separate question. If the strategy loses money, Telegram just notifies you about your losses faster.
Is there a better approach than getting ChatGPT to write the code?
For most retail traders, yes: use AI for decisions instead of code. Tools like DoIt Alpha Pulse AI let an LLM make trade decisions in real time, with the EA structure already built and battle-tested. You skip the coding entirely and let the AI do what it’s actually good at — contextual decision making — instead of what it’s mediocre at — writing other code.
Can I use Claude or Gemini instead of ChatGPT to write the EA?
Yes. Claude (especially Opus 4.7) tends to produce cleaner first-iteration MQL5 than ChatGPT in my testing. Gemini is faster but more error-prone. None of them solve the strategy validation problem. The choice of model affects code quality; it doesn’t affect trade outcomes.
What’s the minimum experience level to use AI to write an EA safely?
Honestly: if you can’t read MQL5 well enough to spot a wrong array index or a missing news filter, you’re not ready to deploy AI-generated EA code on a live account. Use it for learning. Use a battle-tested EA for actual trading.
This experiment was conducted on real broker accounts (demo and live cent) with real money at stake on the live segment. The losses described are real. The conclusions reflect my actual experience and are not financial advice. Backtests were conducted with 99% modeling quality on Dukascopy data; results would differ on lower-quality tick data.
Building or buying an EA and want the next experiments first? The newsletter is where these tests get published before anywhere else: subscribe here.