Skip to content

Learn trading

Leverage and margin

Trading on margin can lose you more than you put in. Past results, including backtests, do not predict future results. Cloud9Trader provides tools and education, not financial advice. Read the full risk warning.

Leverage lets you open a position bigger than the money in your account. Your broker lends you the difference and holds part of your money as a deposit. That deposit is the margin.

The broker sets a margin rate for each instrument. At a rate of 2%, every 100 dollars of position needs 2 dollars of margin, which is leverage of 50 to 1.

Leverage makes gains and losses bigger in the same proportion. A small move in the price can be a large share of your account.

Your broker watches your available margin: your equity minus the margin your open positions use. If losses push it to zero, the broker makes a margin call and closes your positions, often at the worst moment. With leverage you can lose more than you deposited.

An account holds 50,000 US dollars. EUR/USD is at 1.0850 and the margin rate is 2%.

  • A position of 1,000,000 euros is worth 1,000,000 × 1.0850 = 1,085,000 dollars.
  • Margin used: 2% of 1,085,000 = 21,700 dollars. Available margin: 50,000 − 21,700 = 28,300 dollars.
  • Each pip is worth 1,000,000 × 0.0001 = 100 dollars.

If EUR/USD falls 100 pips, to 1.0750, the position loses 100 × 100 = 10,000 dollars, a fifth of the account, on a move of under 1%. Equity falls to 40,000, and available margin to 18,500, because the margin needed falls a little with the price. A fall of about 290 pips would wipe out the available margin and trigger a margin call.

The same 290-pip fall on a position of 100,000 euros loses about 2,900 dollars. Position size, not the price move, decides how much you can lose.

In an algorithm, USED_MARGIN and AVAILABLE_MARGIN report margin as your broker gives it, and each position has its own USED_MARGIN.

Backtests and the demo account apply margin too. Each position uses margin at the instrument’s margin rate. An order is rejected with “Insufficient margin” if there is not enough available margin, and if available margin falls to zero, every open position is closed as a Margin Call. Your broker’s rates can differ from the ones Cloud9Trader uses, so check them before you trade live. To size each trade by how much you would lose at its stop loss, use riskPercentage or riskAmount in openPosition to size each trade by how much you would lose at its stop loss.