Home > Blog > MT5 Not Enough Money Error (10019/134): 6 Causes and Fixes

MT5MQL5

MT5 Not Enough Money Error (10019/134): 6 Causes and Fixes

Published: 2026-06-12Read time: about 5 min
⏱ This article reflects information as of its publish date. EA performance figures (PF, DD, annual return) change with live trading and re-validation — check the latest on the EA pages. See the latest EA results →
Contents (8)
  1. 30-second triage
  2. What ERR_NO_MONEY means (10019 in MT5, 134 in MT4)
  3. Causes & fixes (6 patterns)
  4. Broker-specific notes
  5. MQL5 code to prevent it (for EA developers)
  6. Priority checklist
  7. Summary
  8. FAQ

ERR_NO_MONEY in MQL5

When your Expert Advisor logs ERR_NO_MONEY or not enough money in the Experts/Journal tab, the natural panic is "am I out of funds?" — but this error fires even when your balance still has plenty in it. The cause is rarely "zero money": it's usually lot sizing, leverage, or margin locked up by existing positions.

This is a single, complete reference for ERR_NO_MONEY aimed at both MT5 users running EAs and MQL5 developers writing them — what it really means, the 6 root causes, instant fixes, and the code to prevent it permanently. For the full list of error codes, see the MQL5 / MT5 error code guide.

This article targets MT5 (build 4xxx) as of June 2026. Exact figures and panel names vary slightly by broker and build.


30-second triage

Open MT5 → Toolbox → Trade tab and read these three numbers:

Balance       : cash in the account
Equity        : balance ± floating P/L
Free Margin   : margin available for a NEW position  ← this is what counts
Margin Level %: Equity / Margin × 100
  • If Free Margin is smaller than the margin needed for one new position, you get ERR_NO_MONEY 100% of the time.
  • If balance looks fine but it still fires, it's one of "②oversized lot", "④margin locked by open positions", or "⑥account-type contract size" below.

Check the margin for one lot in MT5: Market Watch → right-click symbol → Specification (Margin per lot). The rough formula:

Required margin ≈ (lots × contract size × price) / leverage

Recommended Broker Comparison →

🎁 Download Free EA

📧 Free 8-email course + subscriber-only pack of 13 MT5 indicators

* Privacy strictly protected. You can unsubscribe at any time.

What ERR_NO_MONEY means (10019 in MT5, 134 in MT4)

ERR_NO_MONEY is a widely used shorthand, not an official constant: neither the MQL5 nor the MQL4 reference defines it. The official name and number depend on the platform (MQL5 trade server return codes, MQL4 error codes).

① MT5: TRADE_RETCODE_NO_MONEY = 10019 (trade server return code)

The result of OrderSend() lands in MqlTradeResult.retcode. When the server rejects the order for insufficient funds, the code is 10019 (TRADE_RETCODE_NO_MONEY). OrderCheck() checks the funds before sending and puts its result in MqlTradeCheckResult.retcode.

Meaning: There is not enough money to complete the request
Constant: TRADE_RETCODE_NO_MONEY
Value   : 10019

② MT4: ERR_NOT_ENOUGH_MONEY = 134 (GetLastError() in MQL4)

134 is the MT4 (MQL4) number. The MQL5 list of runtime errors returned by GetLastError() contains neither 134 nor any not-enough-money code, so in MT5 read the retcode instead.

Meaning: not enough money for the trade operation
Constant: ERR_NOT_ENOUGH_MONEY
Value   : 134 (MT4)

How to tell them apart:

SourceValueWhen it appears
MqlTradeResult.retcode (MT5)10019 (TRADE_RETCODE_NO_MONEY)OrderSend rejected by the server
CTrade.ResultRetcode() (MT5)10019order placed via CTrade rejected
GetLastError() (MT4)134 (ERR_NOT_ENOUGH_MONEY)OrderSend (MT4 / MQL4)

10019 or not enough money in the log means the MT5 trade server rejected the order; 134 comes from an MT4 terminal or EA. The root cause is identical (required margin > usable margin), so the fixes are shared.


Causes & fixes (6 patterns)

① You genuinely ran out of margin

Symptom: floating losses grew and Free Margin dropped below what a new position needs. Common after a losing streak or deep grid/martingale levels.

Fix:

  1. Deposit more funds, or
  2. Manually close part of your open positions to free margin
  3. Lower the EA's RiskPercent so future lots are smaller

If this repeats, the lot size is simply too large for the account → ②.


② Lot size is too big for the balance

Symptom: balance is there, but ERR_NO_MONEY on the very first order. Common with fixed-lot setups.

Cause: FixedLot isn't matched to balance and leverage. Trying 0.1 lot XAUUSD on a ~$670 account can require more margin than the balance, depending on leverage.

Fix:

  1. Drop to the minimum lot (0.01) and see if it opens
  2. Switch to risk-percent auto sizing (UseFixedLot=false / RiskPercent)
  3. If even 0.01 won't open, leverage or funds are short → ③ / ⑥

Rule of thumb: a sound baseline is 0.01 minimum lot on a ~$670 standard account. Below that, or if you want to run smaller and safer, use a cent/micro account (next section).


③ Low leverage, or capped on weekends/events

Symptom: the same EA/lot opens on another account but throws ERR_NO_MONEY on this one — or the error clusters Friday evening to Monday morning.

Cause: low leverage (e.g. 1:30 EU-regulated vs 1:1000 offshore) changes required margin by tens of times. Brokers also cut leverage around weekends and major news (XM caps leverage to 200:1 over the weekend), so required margin can jump while a position is open. Gold and crypto may have per-symbol leverage caps too.

Fix:

  1. Check the account leverage (broker portal / MT5 account info)
  2. Check the per-symbol margin rate in Specification (some symbols are capped lower)
  3. Use a weekend-flat setting (CloseAllBeforeWeekend=true) or a broker without weekend caps
  4. Use a higher-leverage account or reduce the lot

④ Margin locked up by existing positions

Symptom: the first position opens, but the 2nd / a grid add-on throws ERR_NO_MONEY.

Cause: open positions already lock margin, so Free Margin dropped below the new requirement. Common when several pairs or several EAs share one account.

Fix:

  1. Check used Margin vs Free Margin in the Trade tab
  2. Make sure multiple EAs aren't eating each other's margin on one account
  3. Grid/martingale EAs consume margin fast as levels deepen → review max levels, lot multiplier, and emergency-close settings

⑤ Bonus/credit counted into margin

Symptom: "balance + bonus" should be enough, yet ERR_NO_MONEY.

Cause: some brokers exclude credit (bonus) from margin calculations, or count only part of it. The displayed balance and the margin the server actually uses diverge.

Fix: check the broker's bonus terms for whether credit counts toward margin. If not, size the lot to fit the real deposit only.


⑥ Account-type contract size (standard vs cent/micro)

Symptom: the same "0.01 lot" suddenly throws ERR_NO_MONEY after switching accounts (or becomes oversized).

Cause: cent/micro and standard accounts differ in contract size by ~100×. A cent account's 0.01 has ~1/100 the real exposure. An EA that uses a fixed lot without distinguishing account type will hit insufficient margin on one of them.

Fix:

  1. For small/safe operation, use a cent/micro account so the minimum lot isn't over-risked
  2. Don't hardcode account type — let the EA read actual required margin via OrderCalcMargin() and size from it (next section)

Broker-specific notes

BrokerTraitERR_NO_MONEY frequency
XMweekend leverage cap · Stop Out 20%medium (higher on weekends)
Exnessunlimited-leverage accounts · Stop Out 0%low
HFM / FXGT etc.high-leverage accountslow

Exness unlimited-leverage accounts (Pro/Raw Spread) often let new orders through even with near-zero free margin, so this error is rare there — but the flip side is that stop-out barely triggers, so losses can balloon. See the broker comparison for trade-offs.


MQL5 code to prevent it (for EA developers)

Don't just "fix" ERR_NO_MONEY — swallow it before OrderSend in the EA itself. The principle: compute required margin before ordering, and either skip or shrink the lot if it won't fit.

Check required margin before ordering

// Pre-trade gate: confirm required margin <= free margin before OrderSend
bool HasEnoughMargin(ENUM_ORDER_TYPE type, double lots)
{
   double price = (type == ORDER_TYPE_BUY)
                  ? SymbolInfoDouble(_Symbol, SYMBOL_ASK)
                  : SymbolInfoDouble(_Symbol, SYMBOL_BID);

   double margin = 0.0;
   if(!OrderCalcMargin(type, _Symbol, lots, price, margin))
   {
      Print("OrderCalcMargin failed: ", GetLastError());
      return false;
   }
   double freeMargin = AccountInfoDouble(ACCOUNT_MARGIN_FREE);
   if(margin > freeMargin)
   {
      PrintFormat("Skip: need %.2f > free %.2f (ERR_NO_MONEY guard)", margin, freeMargin);
      return false;   // don't open = ERR_NO_MONEY never happens
   }
   return true;
}

Round the lot to "the largest you can open"

If a risk-percent lot exceeds available margin, shrinking it (rather than skipping) reduces missed entries. Normalizing to min lot and lot step is mandatory too — unnormalized lots are a classic rejection cause.

double NormalizeLot(double lots)
{
   double minLot  = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN);
   double maxLot  = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MAX);
   double step    = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_STEP);
   lots = MathFloor(lots / step) * step;          // snap to step
   lots = MathMax(minLot, MathMin(maxLot, lots)); // clamp min..max
   return NormalizeDouble(lots, 2);
}

Always inspect the OrderSend retcode

Don't trust only the boolean return of OrderSend() — read result.retcode and handle 10019 (TRADE_RETCODE_NO_MONEY) explicitly.

MqlTradeRequest req; MqlTradeResult res;
ZeroMemory(req); ZeroMemory(res);
// ... build req ...
if(!OrderSend(req, res) || res.retcode != TRADE_RETCODE_DONE)
{
   if(res.retcode == TRADE_RETCODE_NO_MONEY)   // 10019
      Print("Not enough money. Shrink the lot or deposit funds.");
   else
      PrintFormat("OrderSend failed: retcode=%d, lastError=%d", res.retcode, GetLastError());
}

With CTrade, check trade.ResultRetcode() for 10019, or trade.ResultRetcodeDescription().

Emergency stop on margin level

Halting new entries (or closing all) when margin level drops below a threshold prevents both ERR_NO_MONEY storms and account blow-ups.

double level = AccountInfoDouble(ACCOUNT_MARGIN_LEVEL); // margin level %
if(level > 0 && level < EmergencyMarginLevel)           // e.g. 150%
{
   // stop new entries / optionally close part of the book
}

The EAs distributed by FXEA365 ship with risk-percent auto lots, a pre-trade margin check, and a margin-level emergency stop (UseMarginEmergencyClose) built in, so they run comfortably from a small starting balance.


Priority checklist

PriorityCheckFix
🚨 firstFree Margin < required margindeposit / partial close / lower lot
🚨 firstfixed lot too big for balancego 0.01 / risk-percent auto
⚠️ nextaccount leverage too lowhigher-leverage account / lower lot
⚠️ nextmargin locked by other positions/EAstidy positions on the account
✅ checkcent vs standard contract sizesize to the account type
🛠 devguard with OrderCalcMargin before orderingimplement the code above

Summary

  • In MT5, insufficient funds is 10019 (TRADE_RETCODE_NO_MONEY); 134 (ERR_NOT_ENOUGH_MONEY) is the MT4 number, and ERR_NO_MONEY is shorthand for both. Either way it comes down to required margin > usable margin.
  • It fires even with funds present, due to oversized lots, low leverage, margin locked by open positions, or account-type mismatch.
  • Traders prevent it with risk-percent auto lots and the right account type; developers fix it for good with a pre-trade OrderCalcMargin gate, lot normalization, and explicit handling of retcode 10019.

For all error codes, see the MQL5 / MT5 error code guide; for free EAs sized to run on a small balance, see the EA list.


FAQ

Q: My balance is fine, why ERR_NO_MONEY?

Sizing is judged on Free Margin, not Balance. Floating losses or margin locked by open positions reduce Free Margin, so a healthy balance can still fail to open a new position. Check Free Margin in the Trade tab.

Q: What's the difference between 134 and 10019?

10019 (TRADE_RETCODE_NO_MONEY) is the MT5 trade server return code found in the OrderSend() result; 134 (ERR_NOT_ENOUGH_MONEY) is the MT4 error returned by GetLastError(). Only the platform differs — the cause (insufficient funds) is the same.

Q: It works in backtest but fails live.

The live account's leverage, account type (cent/standard), and existing positions differ from your test setup. Leverage and contract-size differences dominate.

Q: Grid/martingale EAs throw ERR_NO_MONEY as levels deepen.

That's one step before normal margin exhaustion. Each added level consumes margin faster. Lower the max levels and lot multiplier, always enable an emergency close like UseMarginEmergencyClose, and only trade money you can afford to lose.

Q: Can my EA avoid it automatically?

Yes. Before ordering, compute required margin with OrderCalcMargin() and skip (or shrink the lot) if it exceeds AccountInfoDouble(ACCOUNT_MARGIN_FREE). See the code above.

Q: What's a comfortable minimum to start with?

A ~$670 standard account at the 0.01 minimum lot is a sound baseline. For smaller or safer operation, a cent/micro account gives the minimum lot far less real exposure, making ERR_NO_MONEY easy to avoid.

📧 Free 8-email course + subscriber-only pack of 13 MT5 indicators

* Privacy strictly protected. You can unsubscribe at any time.

Have a question about EAs or FX?

You can post it on the Nattzy trading forum (free sign-up). Questions beyond this article are welcome too — EA settings, choosing a broker and more.

Ask on Nattzy ↗

Comments & questions