What ChatGPT Silently Skips When It Writes Your EA

What ChatGPT Silently Skips When It Writes Your EA

19 July 2026, 16:00
Diego Arribas Lopez
0
30

Here is a pattern I have watched repeat for over a year: someone asks ChatGPT for an MT5 EA, gets code that compiles on the first try, runs a backtest that looks reasonable, goes live with real money, and loses a chunk of it inside the first week. Not because the strategy was wrong (that is a separate problem). Because of the ChatGPT MT5 EA edge cases nobody codes for: the generated logic silently assumed a market that does not exist.

ChatGPT writes MQL5 for a laboratory market: constant spread, instant fills, no news, no gaps, no rejected orders. The real market has none of those properties, and the model will not warn you, because you did not ask, and the backtest will not warn you either, because most of these frictions barely exist in the strategy tester. You find out live, which is the most expensive classroom there is.

If that already happened to you, you did not miss something obvious. The failure is invisible by design: clean code, clean backtest, and the trap only springs in production. These are the edge cases that spring it.

1. Spread: The Cost ChatGPT Assumes Is Constant

Generated code treats spread as a static number, when it treats it at all. Live spreads breathe: tight during London liquidity, triple at rollover (around 5pm New York, when liquidity providers reset), and wide open during news. A scalping strategy that backtests beautifully on a fixed 1-pip spread is a different strategy entirely at a 6-pip rollover spread. Same code, opposite outcome.

What production code does: reads the current spread before every entry and refuses to trade above a threshold. It is four lines of MQL5. Ask ChatGPT to add a spread filter and it will do it correctly. It just never adds one unprompted, and most people do not know to prompt for it until the market has already taught them.

2. Slippage and Requotes: The Fill You Did Not Order

ChatGPT's template sends an order and assumes the fill happens at the requested price. On a quiet chart, mostly true. On a fast move (exactly when your EA is most likely to be triggering) the fill lands somewhere else, and every backtest trade silently pretended this cost was zero.

Worse, the generated code rarely checks the trade server's return codes properly. Rejected orders, requotes, and partial fills come back as error states the template ignores or retries blindly. I have seen AI-written EAs fire the same rejected order in a loop, stacking positions the strategy never intended. Production code checks every return code, caps deviation explicitly, and logs what actually happened versus what was requested. That last file is where you learn what your EA really costs to run.

3. News: The Calendar Your EA Does Not Have

Ask ChatGPT for a trading strategy and it will happily produce one that holds positions straight through Non-Farm Payrolls. The model has no concept that at 8:30am ET on the first Friday of the month, spreads explode, stops get jumped, and a 20-pip stop-loss can fill 60 pips away. No generated template includes a news filter, an economic calendar check, or even a "do not open positions in this window" clause.

This single omission is behind an outsized share of the "my EA was profitable for three weeks and then one candle erased it" stories. A real system either reads a calendar feed or, at minimum, hard-blocks known high-impact windows. The first time I connected models to live charts, news handling was one of the seven problems I documented that nobody warns you about, and it still is.

4. Weekend Gaps and Rollover: Time Does Not Pause

Friday close to Sunday open is a hole in the market where price can reappear anywhere. A position held over the weekend can gap far beyond its stop-loss, and the stop fills at the new price, not the one you set. ChatGPT's code has no opinion about Friday afternoons. It also has no opinion about swap costs, triple-swap Wednesdays, or the fact that a "small overnight position" in the backtest carried financing costs the tester barely modeled.

Production behavior is a decision, not a default: either close before the weekend, or size positions so a gap through the stop is survivable. Either is fine. Having no policy, which is what generated code ships with, is not.

5. Why the Backtest Cannot Catch These Edge Cases

Notice the common thread. Every one of these frictions is weakest exactly where the strategy tester lives, and strongest exactly where your money lives. Modeling quality on spread is approximate, slippage is optional, news is invisible, and gaps are smoothed. So the feedback loop most people rely on ("the backtest looks fine") is structurally blind to the failure modes that matter most. This is the same reason perfect backtests lose money live: the tester rewards fitting the past, and the past it shows you is airbrushed.

The only honest test for these edge cases is forward: demo first, then small and live, watching the execution log rather than the equity curve. The first seven days with a new EA are for exactly this: catching the friction, not judging the profit.

This is what "production EA" means.

Spread filters, return-code handling, news windows, weekend policy: Alpha Pulse AI runs all of it underneath the AI decision layer, and it is forward-tested on a public Myfxbook precisely because these edge cases only show up live. The AI gets the headlines; the boring engineering keeps the account alive.

How to Prompt for These (If You Are Building)

ChatGPT can write every safeguard on this page. It just will not volunteer them. So make the prompts explicit:

  1. "Add a maximum spread filter checked before every entry. Make the threshold an input parameter."
  2. "Check and log the return code of every order operation. Never retry a rejected order automatically more than once."
  3. "Add an input-defined time window blackout around high-impact news, during which no new positions open."
  4. "Add a Friday cutoff input: close all positions N minutes before market close, or block weekend holds."
  5. "Log requested price versus filled price on every execution to a file."

Then read the code it gives you, test it on demo, and assume nothing. The model is a competent junior developer with no trading scars. You are the review.

The Honest Close

None of this means ChatGPT is useless for EA development. It means the thirty-second EA is a myth with a specific anatomy: the code is real, the market it was written for is not. The difference between a chat-window EA and a production EA is not intelligence. It is scar tissue, encoded as boring safeguards that only matter on the worst five days of the year, which are the days that decide your year.

Whether you build or buy, audit for the safeguards, not the promises. And if a vendor cannot tell you their EA's spread filter, news policy, and weekend behavior in one breath, you already know which kind of EA it is.

I share what live execution actually looks like (fills, frictions, and the occasional ugly week) in the DoItTrading newsletter. It is the stuff the tutorials skip.

Frequently Asked Questions

Why does my ChatGPT EA work in backtests but lose live?

Usually a combination of overfitting and missing edge-case handling. The strategy tester barely models variable spreads, slippage, news volatility, and gaps, so code that ignores them backtests clean and bleeds live. Check whether your EA has a spread filter, verifies order return codes, blocks news windows, and has a weekend policy. If it has none of those, the backtest was measuring a market that does not exist.

Can I ask ChatGPT to add a news filter to my EA?

Yes, and you should, explicitly. A simple version blocks new positions during input-defined time windows around scheduled high-impact events; a robust version reads an economic calendar source. ChatGPT writes either competently when asked. The point is that no generated template includes one by default, and holding a position through Non-Farm Payrolls with a tight stop is one of the fastest ways to discover why that matters.

Does slippage really matter for a non-scalping EA?

Less than for a scalper, but it never reaches zero, and it concentrates exactly where it hurts: fast markets, news candles, and stop-loss executions. A swing EA with a 50-pip target survives a pip of average slippage; the same EA gapped 40 pips past its stop on a weekend does not care what its average was. Slippage is a distribution with a fat tail, and the tail is the risk.

What is the minimum safeguard set before running any EA live?

Four things: a maximum spread filter on entries, order return-code checking with controlled retries, a policy for high-impact news windows, and an explicit weekend/rollover policy. Add execution logging (requested versus filled price) so you can measure your real costs. Then run the EA on demo long enough to see each safeguard actually trigger at least once before real money is involved.

Do professional EAs handle all these edge cases?

The serious ones do, and it is a useful due-diligence test: ask any vendor how their EA handles spread spikes, rejected orders, news, and weekends. A real answer is specific and instant, because these safeguards are where most of the engineering time went. A vague answer means the EA was built in the laboratory market, and you would be the forward test.