A lot of investing mistakes aren’t about bad ideas—they’re about bad sizing. You can be “right” on a thesis and still blow up a portfolio if positions are too large relative to your risk tolerance.
A simple way to operationalize discipline is a risk budget. Instead of asking “What should I buy?”, ask “How much can I lose on this position without changing behavior?”
Here’s a minimal concept you can implement in any language:
You define three inputs. Your account size. Your maximum risk per trade (or per position) as a percent. Your stop distance as a percent (how far price can move against you before you exit).
Then compute position size as:
Position Size = (Account Size × Risk %) ÷ Stop Distance %
Example:
Account Size = 10,000
Risk per position = 1%
Stop distance = 5%
Your position size becomes (10,000 × 0.01) ÷ 0.05 = 2,000
That’s it. The value isn’t the math—it’s what it prevents. It stops you from “accidentally” taking a 5% account risk because you got excited.
You can extend this into a small web form: inputs, a calculate button, and a “what-if” table that shows how position size changes when stop distance changes. If you want to go one step further, add a rule: total portfolio risk must stay under a defined cap, so multiple positions don’t quietly stack into a blow-up scenario.
The point is not to predict markets. The point is to build guardrails. Systems beat vibes.

Top comments (0)