I think there should be an option to change the way that the “Invested” sum is calculated. If it were calculated by
Total Invested = Total Deposits − Total Withdrawals − Cash,
then reinvested dividends and realised profits will count under “returns”. I think many people may prefer this, especially dividend investors. Of course, not everyone may like this, so I think it should be an option that can be turned on.