Home › Guides › Margin Call

WHY BOTS FAILFREENO ACCOUNTAUTOMATED TRADE BOTSMargin CallThe arithmetic of how bots failEDUCATION ONLY | NO SIGNALSEXAMPLE NUMBERS ARE LABELLEDAUTOMATED TRADE BOTSautomatedtradebots.com
A free page on margin call. Education only, with example numbers labelled.
WHY BOTS FAIL

Margin Call

Short answer

A margin call is a warning, or an automatic action, from your broker when account equity falls too close to the margin your open trades need.

What it is, the two formulas, a worked example with real arithmetic, and why a bot that adds to losing trades reaches it before most people expect.

The page explains the idea in plain words, works through the arithmetic with a table, and shows how it hits grid, martingale and DCA bots, then tells you what to check before you run one.

  • A worked example with real arithmetic
  • How it hits grid, martingale and DCA bots
  • How to check for it before you run a bot
  • No advice, no signals, no profit promises

Last reviewed 28 October 2026. Education only, not advice.

Free, no account Runs in your browser Worked numbers shown Not advice Examples labelled

Ready to go further

Margin decides if you are still trading when a bad run arrives

Expected value tells you the average. Check the average first, then the margin.

Reading time4 minutes
Worked exampleExact arithmetic
Tools linked2 on this page
Reviewed28 Oct 2026

What is included

  • What it is, in plain words
  • The formula or mechanism, with exact arithmetic
  • How it hits grid, martingale and DCA bots
  • A check you can run before you switch a bot on

Who it is for

  • People who run or plan to run a trading bot
  • Anyone reading a backtest or a bot sales page
  • Readers who want the numbers, not the pitch
  • Not advice, and not a signal service
Margin level as the floating loss grows (example, $1,000 account)0%100%200%300%Margin call level (example 100%)Stop out level (example 50%)300%100%50%$0-$300-$600-$900Floating loss on the open position
The picture for this page. Example numbers are made up unless the page says they were calculated.

Key facts

  • A margin call is a warning, or an automatic action, from your broker when account equity falls too close to the margin your open trades need.
  • Margin level = equity / used margin x 100. Each broker sets its own margin call level and stop out level. Some use 100 percent and 50 percent, others differ, so read your broker's terms.
  • At stop out the broker closes positions, usually the biggest losers first, whether or not you want them closed.
  • A bot that adds to losing trades uses the most margin exactly when equity is lowest.
  • The example numbers on this page are made up to show the mechanics. They are not from any broker or bot.

What a margin call is

When you trade with leverage, the broker holds part of your account as margin against each open position. If trades move against you, your equity falls while the margin stays held. A margin call is the broker's signal that the cushion between the two is getting thin.

Depending on the broker it may be an email, a banner in the platform, or nothing at all before the next step. The next step, the stop out, is automatic. The broker closes positions to free margin, and it does this at the market price available at that moment, which in a fast market can be worse than the price you saw.

The two formulas

Used margin = position value / leverage
Margin level = equity / used margin x 100

Equity is your balance plus or minus the floating profit or loss on open trades. Free margin is equity minus used margin, and new positions need free margin to open.

A worked example with one position

Take a $1,000 account holding one position worth $10,000 at 30:1 leverage. Used margin is $10,000 / 30 = $333.33. With no floating loss the margin level is 1,000 / 333.33 = 300 percent. Now let the position lose money while the account stays otherwise unchanged:

Floating lossEquityMargin levelWhat happens in this example
$0$1,000300%
-$300$700210%
-$500$500150%
-$667$333100%Margin call level reached
-$833$16750%Stop out level reached

For a currency pair quoted in dollars, a $10,000 position moves about $1 per pip, so a $667 loss is roughly 667 pips. One small position is a long way from a margin call. The danger comes from size and from adding more positions as the first one loses.

Why bots reach it first

A martingale or grid bot opens extra positions as price moves against it, and martingale bots make each one bigger. That is the opposite of what the margin level needs: more margin used at the moment equity is shrinking. Here is a ladder that doubles every step, starting at 0.1 lot (a $10,000 position), on the same $1,000 account at 30:1:

StepNew lotsTotal lotsMargin usedShare of the $1,000
10.10.1$33333%
20.20.3$1,000100%
30.40.7$2,333233%
40.81.5$5,000500%
51.63.1$10,3331,033%

The second step already needs all of the starting balance as margin, before counting the floating loss that made the bot add it. In practice the broker rejects the order for lack of free margin, and the ladder stops where the account does, with every earlier loss still open.

Margin used by a doubling ladder (example)$333Step 10.1 lots total$1,000Step 20.3 lots total$2,333Step 30.7 lots total$5,000Step 41.5 lots total$10,333Step 53.1 lots totalThe whole $1,000 account
Margin used by each step of a doubling ladder, against the $1,000 account. Bars turn amber once margin used reaches the whole starting balance.

What a stop out does to a bot

  • The recovery logic never gets to run. A bot built to win back losses by waiting is closed out at the low.
  • Positions close at whatever price is available. In a gap the fill can be worse than the stop out level suggests, and some account types can end with a negative balance.
  • The bot may reopen. If it is still switched on, it can start the same ladder again on what is left.
  • The record looks different afterwards. A stop out usually appears as one very large loss in the account history, which a backtest that ignored margin would not have shown.

Checks before you run any bot

  • Find your broker's margin call level and stop out level, and write them down.
  • Work out the largest total position the bot can open, step by step, and the margin that needs.
  • Work out how far price has to move for the bot to reach that point, with the floating loss included.
  • Decide your own cap on margin used, test the bot against it, and check what the bot does when an order is rejected.
  • Run it on a demo account through a fast move before it touches real money.

FAQ

Frequently Asked Questions

Is a margin call the same as a stop out?

No. A margin call is the warning level and a stop out is the level where the broker starts closing positions. Some brokers send no warning and go straight to the stop out. Check which levels your broker uses.

Does a margin call mean I lose everything?

Not necessarily, but it can come close. At stop out the broker closes positions at market prices, so the loss is whatever the account has fallen to by then. On some account types a fast gap can leave a negative balance.

Can a bot avoid margin calls?

It can be written to size positions inside your margin and to stop adding when free margin runs low. That is not certain to work in a fast market, and many martingale and grid bots are written to keep adding.

What is free margin?

Equity minus used margin. It is the room left to open new positions or absorb more loss. When it reaches zero, new orders are rejected.

Will the broker warn me first?

Not always. Some send an email or platform alert at the margin call level, others act at the stop out level only. A bot running unattended may not be able to act on a warning, so its own limits matter more.

Are the numbers on this page real?

Example numbers are made up to show how the maths works, and the page says so. A figure only counts as exact when the page says it was calculated on a stated date. Nothing you enter in a calculator leaves your browser.

Can I use this to decide whether to run a bot?

It can show whether a bot's numbers hold together and how much an account can lose. It cannot say what the market will do, and it is not advice. Use it to ask better questions, then read the terms of your own broker or exchange.

Is this financial advice?

No. It explains how margin works in general. Your broker's terms decide what happens on your account.

Know the Risk Before You Run It

Free calculators and guides, added every week. Leave your details and we will email you when new ones go up.

Trading carries a risk of loss