Maths: lots = (balance × risk%) ÷ (stop in pips × pip value per lot). Standard lot = 100,000 units (gold: 100 oz). Check your broker's contract size before trading.
About this calculator. The result is an educational estimate. Contract sizes, pip values, spreads, commissions and overnight financing differ by broker and by instrument, and fills can differ from the prices you model. Check your own account's specification before trading.