A beginner sees leverage of 20 and opens a trade for the full $20,000, “because I can”. The price moves half a percent against him — and he’s down $100. That’s a tenth of the account from one small move.
Now by the calculation. You have $1,000 in your account, your risk is $10, and the stop is close — 0.5% from your entry. Every $100 of the trade loses 50 cents at the stop. To lose no more than $10, you need 20 times $100 — a $2,000 trade. You don’t have enough of your own money, so you take leverage of 5: margin $400. If the stop triggers — minus $10, exactly as planned.