PipWardenStart free

Forex margin calculator with margin level and stop-out

Enter the instrument, your lot size and your leverage. The margin, the margin level and the distance to a stop-out update as you type.

Loading the calculator…
On this page
  1. How it works
  2. The margin formula
  3. Worked examples
  4. Leverage caps for retail clients
  5. Margin level, margin call and stop-out
  6. Common mistakes
  7. How PipWarden handles this

Margin is the deposit your broker sets aside to keep a trade open: the position’s value divided by the leverage, in your account currency. On a USD account, 0.50 lot of EURUSD at 1.13550 with 1:30 leverage needs $1,892.50 of margin.

The calculator above does this for 28 currency pairs, gold, silver, four index CFDs and bitcoin, in 16 account currencies. With your equity it also shows the free margin, the margin level, the effective leverage and how far price can move against the position, long or short, before a stop-out. It is a risk check, not a tool for finding the most you can open.

How it works

  1. Margin. MT5 works it out by the symbol’s calculation mode, listed as Calculation in its Specification window (right-click the symbol in Market Watch, then Specification): Forex, CFD, CFD Leverage or CFD Index. A non-zero Initial margin there replaces the formula with a set amount per lot.
  2. Notional value and effective leverage. The full value of the position, and that value divided by your equity. This is the leverage you are actually running, whatever the account allows.
  3. Free margin and margin level. Equity minus margin, and equity divided by margin.
  4. Distance to the stop-out. The price at which the margin level falls to your broker’s stop-out level, for a long and for a short, in pips and as a price.

If the margin is first worked out in another currency, one exchange rate converts it. The rate is shown with its date and you can type today’s price.

The margin formula

MT5’s margin formulas by calculation mode:

Forex         lots × contract size ÷ leverage
CFD Leverage  lots × contract size × price ÷ leverage
CFD           lots × contract size × price × margin rate
CFD Index     lots × value per point × price × margin rate
Per lot       lots × margin per lot

margin level  = equity ÷ margin × 100
free margin   = equity − margin
stop-out at   equity + running result
                = stop-out % × margin

Forex gives the margin in the base currency and the CFD modes in the quote currency; either is then converted into your account currency. Dividing by the leverage is the same as multiplying by a margin rate: 1:30 is a 3.33% margin, 1:20 is 5%. The calculator’s CFD mode covers CFD and CFD Leverage: enter your leverage, or the symbol’s margin rate as a margin %. An Initial margin is in the margin currency, and Forex and CFD Leverage symbols divide it by the leverage: convert it before using Per lot.

The margin and the value of a move both change with the price, so the calculator solves the last line for each direction. A long and a short reach the stop-out at different distances.

Worked examples

All use a made-up USD account with $5,000 of equity and a 50% stop-out. Prices are illustrative.

When the pair’s base currency is your account currency, no rate is involved: 0.50 lot of USDJPY at 1:30 needs 0.50 × 100,000 ÷ 30 = $1,666.67 on a USD account at any price.

Leverage caps for retail clients

ESMA capped CFD leverage for retail clients of EU brokers in 2018, and set a margin close-out at 50% of the required margin, per account:

Asset class Leverage cap Margin
Major currency pairs 30:1 3.33%
Non-major currency pairs, gold, major indices 20:1 5%
Commodities other than gold, non-major equity indices 10:1 10%
Individual equities and other reference values 5:1 20%
Cryptocurrencies 2:1 50%

A major pair is any two of the US dollar, euro, yen, pound, Canadian dollar and Swiss franc, so pairs with the Australian or New Zealand dollar are non-major. The calculator starts at the cap for the instrument’s class and shows it next to the result. Brokers regulated elsewhere may offer more.

Margin level, margin call and stop-out

Your margin level falls as open trades lose. A broker’s margin call level is a warning. At the stop-out level the broker starts closing positions, and it does not wait for your stops. Both levels are in your account terms.

The distance to the stop-out is for one position on its own. It follows the margin as the price moves, but holds any second exchange rate (GBPUSD for EURGBP on a USD account) at today’s value. It leaves out spread, swap and commission, and every other open trade draws on the same equity.

Common mistakes

  • Reading leverage as risk. The loss per pip depends on the lot size, not on the leverage; more leverage only lets a larger position fit. The pip value calculator shows what a pip is worth at your size, and the position size calculator sizes a trade from its stop.
  • Using free margin as a size target. Opening everything the margin allows leaves almost no room before a stop-out.
  • Forgetting other positions. The margin level is for the whole account. Two trades share one cushion.
  • Missing margin changes. Brokers can raise margins around weekends, holidays and major news, and some tier the leverage by position size. Check your broker’s terms.

How PipWarden handles this

PipWarden does not size trades from the margin available. It sizes every order from your risk limit, using the tick value and volume step that MT5 reports for the symbol, rounds down, and skips a trade that would need less than the minimum lot rather than raising the risk. Before every order it also checks that the free margin left after the new order’s margin stays above your minimum, 20% of equity by default, using the margin MT5 reports for the symbol where it can.

Those checks happen when an order is placed. Open trades run to their own stops, and gaps or slippage can make a loss larger than planned. PipWarden runs in MT5 on a Windows PC or VPS, with a broker that allows Expert Advisors; it does not run on a phone. See how it works, the features and which brokers work, and read the risk disclosure.

Frequently asked questions

How is forex margin calculated?
Lots × 100,000 ÷ leverage gives the margin in the pair’s base currency, which is then converted into your account currency. For 0.50 lot of EURUSD at 1:30 that is 0.50 × 100,000 ÷ 30 = €1,666.67, or $1,892.50 at 1.13550 on a USD account.
How is margin calculated for gold (XAUUSD)?
Lots × contract size × price ÷ leverage, or × the symbol’s margin rate where your broker sets one. At the usual 100 oz per lot, 0.10 lot at 3,000.00 with 1:20 needs 0.10 × 100 × 3,000.00 ÷ 20 = $1,500.00. Check the contract size in your broker’s Specification window.
How is margin calculated for NAS100, US30 and other indices?
Lots × value per point × price × the margin rate. At 21,000.00 and a 5% margin, 1.00 lot needs $1,050.00 if your broker pays $1 per point, and $10,500.00 if it pays $10 per point.
What is margin level?
Equity divided by the margin in use, as a percentage. With $5,000 of equity and $1,892.50 of margin the margin level is 264.2%. Brokers act on it: a margin call level warns you, and at the stop-out level they start closing positions.
What is free margin?
Equity minus the margin in use: what is left to open further trades or absorb running losses. It shrinks as open trades lose, because their running losses come off the equity.
What is the difference between a margin call and a stop-out?
A margin call is a warning level; a stop-out is the level at which the broker closes positions for you. Both are margin levels set in your broker’s account terms. For retail clients of EU brokers, ESMA sets the close-out at 50%.
What leverage should I use?
The calculator does not pick one for you. Leverage decides how much margin a position ties up, not how much it loses per pip: 0.50 lot of EURUSD moves $5.00 per pip at 1:30 and at 1:500. The lot size you trade sets the risk; the position size calculator works it out from your stop.
Embed this calculator on your site

Free to use on your site or blog. It sizes itself to fit; please keep the line with the link under it.

<iframe src="https://pipwarden.com/embed/margin-calculator" title="Margin calculator" width="100%" height="1500" style="border:0;max-width:760px" loading="lazy" data-pipwarden-embed></iframe>
<script async src="https://pipwarden.com/embed.js"></script>
<p style="font-size:13px">Free calculator by <a href="https://pipwarden.com/tools/margin-calculator" rel="nofollow">PipWarden</a></p>

Educational content, not financial advice. Forex and CFDs are traded on margin and are high risk: you can lose money, and more than your deposit with some brokers. Examples use made-up numbers and show no real results. Read the risk disclosure.