Investezo
AI + EAs · Guide

Can DeepSeek write an MT5 expert advisor?

Written by the Investezo AI · 17 Oct 2026

Short answer: yes, DeepSeek can write MQL5 code for a MetaTrader 5 expert advisor (EA), often code that compiles after one or two rounds of fixes. Like every AI model, it does not know a profitable strategy by default. The code is the easy part; the test decides whether the EA is worth anything.

Why people try DeepSeek for EAs

  • It is cheap or free to try, and its models are known for strong coding results.
  • Some of its models have open weights, so you can run them yourself.
  • Traders already post MQL5 jobs asking for EAs that use DeepSeek, for example this MQL5 freelance request.

Model names and versions change every few months. Check DeepSeek's own documentation for the current model before you start.

Two ways to use DeepSeek with MT5

  1. DeepSeek writes the EA. You give it rules, it gives you MQL5 code, you compile it in MetaEditor. The EA runs on its own, with no AI at trade time.
  2. The EA calls DeepSeek while it trades. The EA sends market data to the DeepSeek API and acts on the answer. This adds delay, API cost, outages and answers that change from call to call. It is much harder to backtest, because the tester cannot replay the API's past answers.

For most traders, way 1 is the only one you can test properly.

What DeepSeek usually gets right

  • Inputs, order functions with the CTrade class, magic numbers, simple indicators (MA, RSI, ATR).
  • Turning clear rules into code: "buy when the 20 EMA crosses above the 50 EMA on M15, stop loss 2 × ATR".
  • Explaining compiler errors when you paste them back.

What usually breaks (check every time)

  1. MQL4 mixed into MQL5. Old OrderSend calls with MQL4 arguments, or Bid/Ask used as MQL4 variables. Compile and read every warning.
  2. Lot and stop maths. Points vs pips vs price, wrong digits on gold (XAUUSD), a stop placed on the wrong side.
  3. No guard rails. No limit on open trades, no check for an existing position, no spread filter.
  4. Hidden grid or martingale. Ask for "high win rate" and you may get an EA that adds to losers. It looks smooth until one big move.
  5. Overfitting. Asking it to "improve the backtest" again and again fits the past, not the future.

How to test a DeepSeek-made EA

  1. Write one plain prompt and save it. Same prompt every time, so you can compare models fairly.
  2. Fix only compile errors and write down each fix. Do not hand-tune the strategy.
  3. Backtest in the finest tick mode you have, with your broker's real spread and commission.
  4. Test more than one market mood: a calm period and a volatile one.
  5. Change one setting a little. If the result collapses, the edge was luck.
  6. Forward test on its own demo account for weeks, with no changes.
  7. Rank by survival, not profit: worst floating loss, deepest drawdown, how long it ran without breaking. See the Survival lab.

DeepSeek vs ChatGPT, Claude and Gemini

We test them side by side with the same prompt in the AI EA Arena. The race has not started yet, so there are no results to show and we will not guess a winner. Related guide: Can ChatGPT write a profitable EA?

Prompt you can copy

Write an MQL5 expert advisor for MetaTrader 5, symbol XAUUSD, timeframe M15. Rules: [your entry], [your exit]. Fixed lot input, stop loss and take profit in price points as inputs, max 1 open position per magic number, spread filter input, no grid, no martingale. Use the CTrade class. Comment every block.

FAQ

Is DeepSeek better than ChatGPT for MQL5?
We do not know yet. We will publish the Arena results when the race runs.

Can I run a DeepSeek EA live?
Only after a fine-tick backtest and weeks on demo with no changes. Check lot size and stop loss first.

Does the EA need the DeepSeek API to trade?
Not if DeepSeek only wrote the code. Only EAs that call the API at trade time need it.

Sources: MQL5 freelance job "Create an Expert Advisor that can use deepseek". Opened 17 Oct 2026.