The general form is: size = (account equity x risk fraction) / (stop distance x multiplier). Everything else in sizing is a variation on this line.
Stocks: $50,000 account, 1% risk = $500; entry $18.20, stop $17.45, distance $0.75; size = 666 shares, rounded down to 650 or 600. Futures: same $500, an ES stop of 12 points at $50 per point = $600 per contract, so one contract is already too big - you either widen the account, use micro-futures, or skip the trade. Forex: $500 risk, a 25 pip stop on a pair worth $10 per pip per standard-lot gives 2.0 lots.
Always round down and always check the answer against buying-power and max-open-risk. The formula tells you the largest size your risk rule allows; it never tells you the position is a good idea.
Related: dollar-risk, stop-distance, position-size-rounding, max-open-risk