Fix the loss before the size
The risk budget is the maximum modeled loss if the stop fills at its stated price. Position size is derived from that budget and the distance between entry and stop.
Risk budget = capital × risk % · Units = risk budget ÷ |entry − stop|