When an Expert Advisor (EA) opens a trade, your broker sets aside part of your money as a deposit for it. That deposit is the margin, and leverage decides how big it is. Neither one decides how much you lose if the trade goes wrong. This page explains what they do decide, how MetaTrader 5 (MT5) works out the margin for a trade, and what happens when an account runs short of it.
Leverage is shown as a ratio, such as 1:30 or 1:100. On a currency pair, 1:100 means a trade needs a deposit of one hundredth of its size.
The broker sets the leverage for each account, from the choices it offers for your country and account type, and can charge more margin on particular symbols (see margin rate, below), which works like a lower leverage on those symbols. When you open a demo, you pick it from what's offered, so a demo's leverage can differ from the live account you'd actually use. Note both.
What leverage changes: the margin a trade needs, so how many trades fit in your account, and how far the account can fall before the broker starts closing trades.
What it doesn't change: the money a trade gains or loses per pip. That comes from the lot size and the pip value (page 0.1). A 0.40-lot trade loses the same amount per pip at 1:30 as at 1:100.
MT5 works out the margin from the symbol's calculation mode, which you'll find in the symbol's Specification window. The common ones (formulas from the MT5 help, per lot traded):
| Calculation mode | Margin for one lot, before conversion and margin rate |
|---|---|
| Forex | contract size ÷ leverage |
| Forex No Leverage | contract size |
| CFD, Exchange Stocks | contract size × market price |
| CFD Leverage | contract size × market price ÷ leverage |
| CFD Index | contract size × market price × tick price ÷ tick size |
| Futures and exchange futures | the symbol's initial margin to open a position; its maintenance margin, if the broker sets one, to keep it open |
The MT5 help calls the three CFD modes Contracts, Contracts Leverage and Contracts Index; the MQL5 reference calls them CFD, CFD Leverage and CFD Index. They're the same modes. A few other modes (bonds, for example) have their own formulas, listed in the MT5 help.
Three more steps turn that into the figure that matters:
The result is the final margin for one lot, in your account currency. That's the figure to write down. The Initial margin field on its own is never that figure. Two cautions: margin rates can rise with the volume you hold, so check the rate at the size you'd trade; and once there's more than one position or order on a symbol, MT5 recalculates the margin for all of them together (opposite trades, for example, are charged by the broker's hedged-margin rule), so the Trade tab's Margin figure is the one that counts, not lots times the one-lot figure.
Example (Illustrative): EURUSD, Forex mode, contract size 100,000 euros, leverage 1:100, a dollar account, margin rate 1.
On a hedging account, a buy and a sell held together on the same symbol may be charged less margin than the two separately. How much less is the broker's setting.
MT5's Trade tab shows these on one line:
In the example: equity 10,000, margin 434, so free margin is 9,566 and the margin level is about 2,304%.
The broker sets two levels for every account, either as a margin-level percentage or as an amount of money:
A stop out is not a stop loss. A stop loss is a level you set on one trade. A stop out is the broker closing your trades because the account can't carry them, at whatever loss they're showing.
Example (Illustrative): with a stop out at 50%, the account above would reach it when equity falls to 217 (50% of 434). The 0.40-lot trade loses 4 per pip, so that's a fall of roughly 2,446 pips. With a 25-pip stop on the trade, the stop closes it long before margin matters.
For an EA with a stop on every trade, sized from your risk, leverage mostly decides how many trades fit. For an EA that adds trades without a stop, such as a grid or martingale, the stop out is often where the losing run finally ends, and it can take most of the account. That's why the number to check is the total loss an EA could carry, not the leverage.
MT5 details checked against MetaQuotes' MetaTrader 5 help and MQL5 reference, October 2026. Examples are illustrative; read your own broker's figures.
Trading involves risk. Only trade with money you can afford to lose. This page is educational and is not financial advice.

© 2026 The Robotic Trader. All rights reserved.