Position size calculator
Type a balance, a percentage, a stop distance and a value per point, and see the position size and the amount at risk, with the sum written out.
Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.
Work the sum
This illustrates the lesson Write a function: size a position from the risk you choose. It is not advice on how much to risk, on whether to trade, or on anything else. It suggests no figure: every number is one you type.
The formula
amount at risk = account balance × percentage ÷ 100 position size = amount at risk ÷ (stop distance in points × value of one point)
A wider stop with the same amount at risk gives a smaller position, because each unit can lose more before the stop is reached. That is the whole idea the lesson teaches.
What it does, and what it cannot tell you
It does the two divisions above and shows each step, so you can check them by hand. Nothing you type leaves your browser.
It cannot tell you what percentage to choose, where a stop belongs, or whether a trade is sensible. It does not know your instrument: the value of one point, the smallest size a provider accepts and the steps a size moves in are all set by the provider and are not recorded here, so the result is not rounded to any of them.
It also assumes the position closes exactly at the stop. A market can move past a stop before the order fills, and the loss is then larger than the amount shown.