Leverage in forex is the ratio between a position's full value and the margin a broker requires to open it. At 1:30, a 30,000 EUR position needs 1,000 EUR of margin, which is 3.33% of its value. Leverage sets how much margin a trade ties up and how large a position the account can carry. Leverage does not change the profit or loss per pip, which depends on the lot size.
Keep three numbers apart: the account's leverage ratio, the margin a position uses, and the position size that sets the money at stake per pip. The trading mechanics library covers the neighbouring pieces, from lots and pips to margin level and costs.

Leverage in forex at a glance
Scroll horizontally to read every column.
| Term | What it means | Where to read it |
|---|---|---|
| Leverage ratio | Position value compared with the margin it requires, written 1:30 or 30:1. | MT5 account properties. MQL5: ACCOUNT_LEVERAGE
|
| Margin | Money set aside to open and hold positions. MT5 Forex mode: lots × contract size ÷ leverage. | MT5 Trade tab: Margin. Symbol Specification: Calculation |
| Margin percentage | 100 ÷ leverage: 1:30 is 3.33%, 1:100 is 1%, 1:500 is 0.2%. | Broker terms. TradingView strategy leverage inputs |
| Money per pip | Lots × pip value per 1.00 lot. Leverage is not in the formula. | Symbol Specification: contract size |
| Free margin | Equity minus margin: what is left to open new positions. | MT5 Trade tab |
| Margin level | Equity ÷ margin × 100, compared with the broker's margin-call and stop-out levels. | MT5 Trade tab. MQL5: ACCOUNT_MARGIN_SO_CALL, ACCOUNT_MARGIN_SO_SO
|
Definitions follow MetaQuotes' MetaTrader 5 Help and MQL5 Reference, as of 25 September 2026.[1][2][3]
How do you calculate forex margin from leverage?
Margin = lots × contract size ÷ leverage × margin rate
MetaTrader 5's Forex calculation mode gives margin as "Volume in lots * Contract size / Leverage". MetaQuotes' example: 1 lot of EURUSD with a 100,000 contract at 1:100 needs 1,000 EUR.[1]
- Lots × contract size is the position in base-currency units: 1.00 lot of EURUSD is 100,000 EUR on a 100,000-unit contract. See the lot size and contract size guide.
- Currency conversion. The result is in the symbol's margin currency, usually the base currency. MT5 converts it to the deposit currency at the current rate, using the Ask for buys and the Bid for sells.[1]
- Margin rate is a multiplier in the symbol specification. It can depend on position type and can float with the account's positions.[1]
Two exceptions matter. If the symbol specification sets a fixed initial margin, Forex mode uses lots × initial margin ÷ leverage. Forex No Leverage mode ignores leverage.[1] The Specification's Calculation field shows the mode, and its margin values "should be considered indicative" because they are not updated in real time.[4]
Margin percentage = 100 ÷ leverage
TradingView's Pine Script documentation states that "leverage is the inverse of margin", so 4:1 equals 25% margin.[5] IG defines the leverage ratio as "a measurement of your trade’s total exposure compared to its margin requirement".[6]
Leverage vs margin vs position risk: what changes and what does not?
Leverage decides how much margin a position ties up. Position size decides how much money moves per pip:
Pip value per 1.00 lot = pip size × contract size, converted to the account currency
Money per pip = lots × pip value per 1.00 lot
Leverage appears in neither formula. IG puts it plainly: profit or loss "will be calculated on the full position size, not your margin amount".[6] On a five-decimal EURUSD quote, one PineConnector pip is 0.00010.[7] So 1.00 lot on a 100,000 EUR contract moves 0.0001 × 100,000 = 10 USD per pip at any leverage (see the pip value guide).
Three things do change with leverage:
- Margin used, and so free margin. MT5 defines free margin as "Equity - Margin", the money "that can be used to open positions".[2]
- The largest position the account can open. At 4:1, TradingView notes, a trader "can open a position for up to four times their available funds".[5]
- Margin level, which the broker compares with its margin-call and stop-out thresholds.[2][3]
For a fixed lot size, leverage does not change profit or loss per pip. It changes used margin and the account’s stop-out conditions. Using spare margin for a larger position increases profit or loss per pip.
Worked example: one account at 1:30, 1:100 and 1:500
Illustrative example, not a recommendation. A USD account holds 12,000 USD of equity and no open positions. The broker's EURUSD symbol uses Forex mode, a 100,000 EUR contract and a margin rate of 1. The Ask is 1.20000, and pip value per 1.00 lot is 0.0001 × 100,000 = 10 USD.
Step 1: the same 1.00 lot at three leverage settings
1.00 lot is 100,000 EUR, worth 100,000 × 1.20000 = 120,000 USD. The position is 120,000 ÷ 12,000 = 10 times the account's equity, whatever the leverage.
| Account leverage | Margin for 1.00 lot | Margin level at entry |
|---|---|---|
| 1:30 | 100,000 ÷ 30 × 1.20000 = 4,000 USD | 12,000 ÷ 4,000 × 100 = 300% |
| 1:100 | 100,000 ÷ 100 × 1.20000 = 1,200 USD | 12,000 ÷ 1,200 × 100 = 1,000% |
| 1:500 | 100,000 ÷ 500 × 1.20000 = 240 USD | 12,000 ÷ 240 × 100 = 5,000% |
A 50-pip move against the position costs 50 × 10 = 500 USD in every row. Margin ranged from 4,000 USD to 240 USD, and the money per pip stayed at 10 USD.
Step 2: the largest position each setting allows
Free margin before the trade is 12,000 USD. Dividing it by the margin per lot gives the largest position before free margin reaches zero, ignoring spread and commission.
| Account leverage | Largest position | Money per pip |
|---|---|---|
| 1:30 | 12,000 ÷ 4,000 = 3.00 lots | 3.00 × 10 = 30 USD |
| 1:100 | 12,000 ÷ 1,200 = 10.00 lots | 10.00 × 10 = 100 USD |
| 1:500 | 12,000 ÷ 240 = 50.00 lots | 50.00 × 10 = 500 USD |
At that size the margin used equals equity, so margin level starts at 100%. Exposure is then 360,000, 1,200,000 and 6,000,000 USD: 30, 100 and 500 times equity.
Step 3: how far price can move before an illustrative 50% stop-out
Adverse pips to stop-out = (equity − stop-out level × margin) ÷ money per pip
The formula follows from the margin level definition. At an illustrative 50% stop-out level, each largest position reaches stop-out when equity falls to 50% × 12,000 = 6,000 USD, a 6,000 USD loss:
- 1:30, 3.00 lots: 6,000 ÷ 30 = 200 pips.
- 1:100, 10.00 lots: 6,000 ÷ 100 = 60 pips.
- 1:500, 50.00 lots: 6,000 ÷ 500 = 12 pips.
For the single 1.00 lot in Step 1, the formula gives (12,000 − 0.5 × 4,000) ÷ 10 = 1,000 pips at 1:30 and (12,000 − 0.5 × 240) ÷ 10 = 1,188 pips at 1:500. For a fixed lot, higher leverage moves stop-out further away.
The example holds margin at its opening value and ignores spread, commission and swap. MT5 converts margin at the current rate, so real figures differ slightly.[1] Stop-out levels are broker settings.

How does leverage interact with margin call and stop-out?
MetaTrader 5 shows the account's equity, margin, free margin and margin level in the Trade tab. MetaQuotes defines margin level as "Equity / Margin * 100". The account line turns red "if the account is in the Margin Call or Stop Out state".[2]
-
The thresholds belong to the broker. MQL5 exposes them as
ACCOUNT_MARGIN_SO_CALLandACCOUNT_MARGIN_SO_SO. Depending onACCOUNT_MARGIN_SO_MODE, each is a percentage or an amount in the deposit currency.[3] - Stop-out closes positions on the server. In MT5's normal mode, "Stop Out causes the position having the largest loss to be closed first". With FIFO-based closing enabled, open time is checked as well.[2]
- A stop-out is not a stop loss. A broker-side stop loss is a price level on the position. A stop-out is the broker closing positions because margin level reached its threshold.
- Leverage acts through margin. Lower margin per lot raises margin level; filling the spare margin with more lots lowers it again, as Step 3 shows.
The margin level, margin call and stop-out guide covers the account-side mechanics in more detail.
Why do regulators cap retail leverage?
In March 2018 the European Securities and Markets Authority (ESMA) agreed EU-wide restrictions on CFDs sold to retail clients. ESMA cited "excessive leverage" among its concerns. It also cited national regulators' analyses showing that "74-89% of retail accounts typically lose money".[8] The restriction set leverage limits on opening a position:
| Underlying (ESMA 2018 wording) | Leverage limit | Margin that implies |
|---|---|---|
| Major currency pairs | 30:1 | 3.33% |
| Non-major currency pairs, gold and major indices | 20:1 | 5% |
| Commodities other than gold and non-major equity indices | 10:1 | 10% |
| Individual equities and other reference values | 5:1 | 20% |
| Cryptocurrencies | 2:1 | 50% |
The same measures added a per-account margin close-out rule "at 50% of minimum required margin" and per-account negative balance protection.[8] ESMA stopped renewing its temporary restriction after 31 July 2019. Most national regulators had by then adopted permanent measures "at least as stringent as ESMA’s measures".[9]
Other jurisdictions use other numbers. In the United States, the CFTC's 2010 retail forex rules set a minimum security deposit of 2% for major currencies and 5% of notional value for others, and let NFA set the specific levels.[10] A 2% deposit corresponds to 50:1 and 5% to 20:1. Limits depend on jurisdiction and client classification and change over time, so read your broker's current terms.
Where does leverage show up in TradingView, MT5 and PineConnector?
Between the TradingView alert and the MT5 order, leverage enters at three points: the strategy's simulation, the message's sizing method and the broker's margin check.
TradingView strategies
A Pine Script strategy simulates leverage with its own settings. TradingView's July 2026 release notes say the Properties tab's margin inputs "have been replaced by “Long leverage” and “Short leverage” inputs".[11] The margin_long and margin_short parameters still set the defaults, and the default of 100 "is equivalent to a leverage ratio of 1:1".[5] The Help Center still uses the older names: 20% margin for longs gives 5:1.[12]
When simulated funds fall below the required margin, the broker emulator liquidates "four times the number of contracts/shares/lots/units required to cover the loss". strategy.margin_liquidation_price returns the price where that would happen. TradingView calls leverage above 500:1 "typically unrealistic".[5] These settings shape the backtest only; the MT5 account keeps its own leverage and stop-out level. The strategy report metrics guide shows where simulated margin calls appear.
MetaTrader 5
- Symbol: the Specification lists the margin currency, the Calculation mode and the "Initial" and "Maintenance" margin rates.[4]
-
Order check: an Expert Advisor can call
OrderCalcMargin(), which returns the margin in the account currency "not taking into account current pending orders and open positions".[13] A request without enough margin fails with 10019,TRADE_RETCODE_NO_MONEY: "There is not enough money to complete the request".[14]
PineConnector
Demo test only. Confirm every account sharing the selected License ID is a demo account before creating the alert. These messages request broker trades or closures. Check the exact symbol and permitted volume, and add your configured secret= if required.[20]
PineConnector's volume parameters decide whether leverage changes the lot size. Illustrative messages for the example's 12,000 USD account, not recommended sizes. Each goes in the TradingView alert's Message field, with your License ID and exact broker symbol:
-
LicenseID,buy,EURUSD,vol_lots=1,sl_pips=20requests 1.00 lot. Leverage changes the margin used and stop-out conditions, not P/L per pip, as in Step 1. -
LicenseID,buy,EURUSD,vol_pct_bal_loss=1,sl_pips=20plans a loss of 1% of balance, 120 USD, at the stop: 120 ÷ (20 × 10) = 0.60 lots before broker volume rounding.[15] Leverage only changes the margin: 0.60 × 4,000 = 2,400 USD at 1:30, 0.60 × 240 = 144 USD at 1:500. -
LicenseID,buy,EURUSD,vol_pct_bal_margin=10,sl_pips=20allocates 10% of balance, 1,200 USD, as margin. PineConnector's reference says leverage, symbol margin requirements, account currency and broker volume limits "are needed to determine lots". It adds: "The margin budget is not a loss limit."[16] With the example's MT5 figures, 1,200 USD is 0.30 lots at 1:30, 1.00 lot at 1:100 and 5.00 lots at 1:500. Here leverage changes the position: 3 USD to 50 USD per pip.
The EA's exact margin-allocation calculation and its rounding are not documented; test on demo. For MetaTrader 4's error 134, not enough margin, PineConnector's error guide says to "Read the required and available margin in the Experts output".[17] The EA's Account Filter Basis can also compare an accfilter= threshold with free margin or margin level.[18]

Keep the stages separate: the alert triggers, the webhook delivers the message, PineConnector processes it and the EA sends an order request. The broker checks the request; acceptance is not a confirmed fill. Inspect the order state, resulting deals and actual position. A deal may open, change or close a position.[19] A later stop-out is a broker action, not a TradingView event.
Common leverage mistakes and limitations
- Treating leverage as risk per trade. The money at stake is lots × pip value per 1.00 lot × stop distance in pips. The position sizing methods guide compares fixed lots, percent risk and cash risk.
- Reading an available ratio as a target. A 1:500 account allows positions worth up to 500 times their margin. The ratio says nothing about what size suits a strategy.
-
Treating a margin budget as a loss limit.
vol_pct_bal_margin=fixes margin, not loss, and ignores the stop distance.[16] - Assuming margin stays fixed. Currency conversion at the current rate and floating margin rates move it.[1]
- Backtesting with unrealistic leverage. TradingView warns that unrealistic margin settings "can cause very misleading backtest results".[5]
- Assuming one ratio applies to every symbol. Regulatory limits differ by underlying, and a symbol can use a fixed initial margin or the Forex No Leverage mode.[1][8]
Automation sends the size you define. PineConnector does not choose leverage or position size, and it does not create an edge. The figures above are arithmetic from the cited formulas, not observed account behaviour.
Frequently asked questions
What is leverage in trading?
Leverage in trading is the ratio between a position's full value and the margin a broker requires to open it. At 1:100, a position worth 100,000 USD needs 1,000 USD of margin. Profit and loss are calculated on the full position, so a small deposit carries a large exposure. The money per pip depends on position size, not on the leverage ratio.
What is the difference between leverage and margin?
Leverage is a ratio, such as 1:30, set on the trading account. Margin is the money a position ties up, found by dividing the position's value by the leverage. In MetaTrader 5's Forex mode, margin equals lots times contract size divided by leverage, times any margin rate. Higher leverage means less margin for the same position.
What does a leverage ratio of 1:100 mean?
A leverage ratio of 1:100 means a position can be worth up to 100 times the margin it uses, so the margin requirement is 1% of the position's value. In MetaTrader 5, 1.00 lot of EURUSD on a 100,000-unit contract needs 100,000 ÷ 100 = 1,000 EUR of margin, converted into the account currency.
Does higher leverage mean more risk?
At a fixed position size, account leverage does not change P/L per pip. It changes used margin and stop-out conditions. Using the available margin for larger positions increases P/L per pip. The numerical capacity and stop-out examples here rely on the stated illustrative broker, fixed-margin and cost assumptions.
What leverage limits apply to retail forex traders?
Limits depend on the regulator. ESMA's 2018 restriction on retail CFDs in the EU capped leverage at 30:1 for major currency pairs and 20:1 for non-major pairs. National regulators later adopted permanent measures at least as stringent. The US CFTC's 2010 rules set minimum security deposits of 2% for major currencies and 5% for others. Check your broker's current terms.
Reviewed 25 September 2026. Facts were checked against the linked sources on that date. Nothing in this article was tested on a trading account and no code was compiled.
Related reading
- Trading mechanics: orders, lots, margin and costs
- Margin level, margin call and stop-out
- Lot size, contract size and lot step
- Pips, points and pip value
- Position sizing methods: fixed lots, percent risk and cash risk
Sources
- MetaQuotes – MetaTrader 5 Help: Margin calculation, retail forex and futures, accessed 25 September 2026.
- MetaQuotes – MetaTrader 5 Help: Executing trades, accessed 25 September 2026.
- MetaQuotes – MQL5 Reference: Account properties, accessed 25 September 2026.
- MetaQuotes – MetaTrader 5 Help: Market Watch, viewing symbol specification, accessed 25 September 2026.
- TradingView – Pine Script v6 User Manual: Strategies, margin and leverage, accessed 25 September 2026.
- IG – What is leverage in trading? The complete guide, accessed 25 September 2026.
- PineConnector – Syntax: PineConnector pip, accessed 25 September 2026.
- ESMA – ESMA agrees to prohibit binary options and restrict CFDs to protect retail investors (27 March 2018), accessed 25 September 2026.
- ESMA – ESMA ceases renewal of product intervention measures relating to contracts for differences (31 July 2019), accessed 25 September 2026.
- CFTC – Final rule regarding retail foreign exchange transactions (fact sheet), accessed 25 September 2026.
- TradingView – Pine Script release notes: July 2026 strategy improvements, accessed 25 September 2026.
- TradingView – How to simulate trading with leverage in Pine Script, accessed 25 September 2026.
- MetaQuotes – MQL5 Reference: OrderCalcMargin, accessed 25 September 2026.
- MetaQuotes – MQL5 Reference: Trade server return codes, accessed 25 September 2026.
- PineConnector – Syntax: vol_pct_bal_loss=, accessed 25 September 2026.
- PineConnector – Syntax: vol_pct_bal_margin=, accessed 25 September 2026.
- PineConnector – Error reference: 134, not enough margin, accessed 25 September 2026.
- PineConnector – EA settings: Account Filter Basis, accessed 25 September 2026.
- MetaQuotes – Basic Principles: order processing and resulting positions, accessed 25 September 2026.
- PineConnector – Test your setup: demo account and License ID scope, accessed 25 September 2026.
PineConnector executes the instructions you send it. It does not select trades, manage money, or hold funds. Trading carries risk, and past performance of any strategy does not indicate future results.