Working backwards from the money you are willing to lose and the distance to your stop to the trade size, rather than picking a size and hoping.
The formula is short: size in lots equals risk amount divided by (stop distance in pips x pip value per lot). Every input has to be in the account-currency, which is where cross pairs need the extra step described in pip-value-cross-pair.
Doing it in this order fixes the loss and lets the size float. Doing it the other way round, choosing a familiar size and then placing the stop, lets the loss float instead, which is how a routine trade turns into a 6% day.
The result should then be checked against margin: a size that passes the risk test can still be refused because it would consume more than your free-margin.
Example: $10,000 account, 1% risk, so $100. Stop is 25 pips away on EUR/USD where a standard lot is $10 a pip. Size = 100 / (25 x 10) = 0.4 lots. Widen the stop to 50 pips and the size halves to 0.2 lots for the same $100.
Original diagrams for the ideas on this page. Illustrative, not real market data.
Margin and leverage. A $5,000 deposit can control a $100,000 position, which is 20:1 leverage. Because the loss is measured on the full $100,000, a 2.5% move against you halves the deposit and brings a margin call, and a 5% move uses all of it.
Educational only, not advice. Spotted an error? Post in Site Feedback.