Your numbers
What it says
Ready to go further
Next: size the position from the risk, not from the margin
Margin tells you what you can open. It does not tell you what you should risk. The position size calculator works backwards from a stop and a loss limit.
What is included
- The calculator, with your own numbers
- The formula written out
- A worked example you can reproduce
- Where grid, martingale and DCA bots break the maths
Who it is for
- People running or testing a trading bot
- Anyone sizing a position or checking costs
- Readers learning how the numbers work
- Not advice, and not for placing trades
Key facts
- Used margin = position value / leverage. Position value = units x price. This is the part of your balance the broker holds while the trade is open.
- Margin level = equity / used margin x 100. Equity is balance plus or minus the floating profit or loss.
- The margin call and stop out levels are set by each broker. The defaults here (100 percent and 50 percent) are only examples, so check yours.
- The loss figures shown are for a long position with nothing else open. Extra positions bring both levels much closer.
- The calculator assumes your account currency is the quote currency, no fees and no swap. Every example number on this page is made up.
How the calculator works
Margin is the deposit a broker holds while a leveraged trade is open. Leverage of 30:1 means the broker holds one thirtieth of the position value. The rest of the trade is not your cash, but every dollar of profit or loss on it is yours.
Used margin = position value / leverage
Free margin = balance - used margin
Margin level = equity / used margin x 100
Effective leverage = position value / balance
The two levels at the bottom of the results table come from the margin level formula turned around. A margin call happens when equity falls to (call level / 100) x used margin. So the floating loss that gets you there is balance - (call level / 100) x used margin. The same sum with the stop out level gives the stop out loss. The tool then shows that loss as dollars, as a percent move in price and as a price.
A worked example
Take a made-up $1,000 account at 30:1 holding a long position of 10,000 units at a price of 1.10. The position is worth $11,000, so used margin is 11,000 / 30 = $366.67 and free margin is $633.33. The margin level is 1,000 / 366.67 = 272.7 percent, and effective leverage is 11,000 / 1,000 = 11 to 1.
With a margin call level of 100 percent, the call comes when equity falls to $366.67, a loss of $633.33. That is 5.76 percent of the position value, so price falls from 1.1000 to about 1.0367. With a stop out level of 50 percent, equity can fall to $183.33 before the stop out, a loss of $816.67, or 7.42 percent, at about 1.0183. These are calculated by us on 27 Oct 2026, exact arithmetic on made-up inputs.
Assumptions
- The account currency is the quote currency, so price moves convert to dollars one for one.
- There are no fees, swap or commission, and no other open positions.
- The position is long. For a short position the loss comes from a rise in price, by the same dollar amount.
- Brokers differ in how they define margin level, whether they warn at all, and which positions they close first. Read your broker's terms.
How a bot that adds positions changes the picture
The table above is one position. A grid, martingale or recovery bot opens more as price moves against it, so used margin grows exactly when equity is shrinking. Both sides of the margin level fraction move the wrong way at once.
Here is a made-up ladder on the same account and price: the first step is 0.1 lot (10,000 units), and each new step doubles the new size. Margin at 30:1 and a price of 1.10:
| Step | New lots | Total lots | Margin used |
|---|---|---|---|
| 1 | 0.1 | 0.1 | $367 |
| 2 | 0.2 | 0.3 | $1,100 |
| 3 | 0.4 | 0.7 | $2,567 |
| 4 | 0.8 | 1.5 | $5,500 |
By step 2 the bot has used $1,100 of margin on a $1,000 account, before any loss is counted. The order would be rejected for lack of free margin, and the ladder would stop with the losing positions still open. The full mechanics, with the stop out and what it does to a bot, are in the margin call guide.
How to use the result
- Enter the biggest total position the bot can reach, not the opening size.
- Compare the price move to the call level with how far the market has moved in a day or a week. Past moves are only context, not a forecast.
- If effective leverage is high, small price moves become large account moves.
- Check what the bot does when an order is rejected for free margin. Some retry, some stop, some skip the step.
Keep Going
Related Tools and Guides
Keep exploring
FAQ
Frequently Asked Questions
What is a good margin level?
There is no single answer. Higher means more room before a margin call. The level only matters against your broker's call and stop out levels, and it falls as soon as the trade loses money.
Is leverage the same as risk?
Leverage sets how much margin is held, not how much you can lose. Position size and stop distance decide the loss. High leverage lets you open a bigger position on a small balance, which is what makes the loss bigger.
Why does the calculator show only a long position?
To keep the sums plain. For a short position the loss comes from price rising instead of falling, and the dollar loss to each level is the same. The price shown would be above the entry, not below.
Why do my broker's numbers differ?
Brokers can use different margin level definitions, tiered leverage by position size, different currencies, fees and swap. Use this to learn the shape, then check your broker's own margin figures.
Can free margin go negative?
Free margin below zero means the position needs more margin than the account has, so a broker would normally reject the order. After a position is open, losses reduce equity and so reduce free margin too.
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 is a calculator and general education. It does not know your broker, your account type or your situation.
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