There are two metrics that are commonly used.
First is time-weighted rate of return. You calculate it for each day, separately. It tells essentially if you reset your investment such that you have $1 in the beginning of the day, what would you have at the end of the day. For example 3% time-weighted rate of return in one day means you would have $1.03 at the end of the day.
Time-weighted rate of return is multiplicative. Example: if one day yields 1%, another 2%, third 3% and fourth 4% then the total return is
1.01*1.02*1.03*1.04 = 1.10355024 or 10.355024%. Not additive in which case the total return would be exactly 10%.
The main difficulty of using time-weighted rate of return is that you have to have the price information for all stocks you hold for each day. In theory, you could skip some days and use only days when something happens (such as you buying or selling a stock or dividends being paid).
Another is money-weighted rate of return. In gives one number, an average annual return for the period for which you did your investment.
It works like this. For every day (
d = 1, 2, 3, ...) when something happened, you calculate
y_d, the number of years from the start of the investment and
F_d, the flow of cash into or out of your portfolio (where cash in is negative and cash out is positive). Then for end of investment you calculate
y_end which is number of years from start of investment, and
F_end, which is the current value of your portfolio.
Then you find r such that
F_1/(1+r)^y_1 + F_2/(1+r)^y_2 + F_3/(1+r)^y_3 + ... + F_end/(1+r)^y_end = 0
Money-weighted rate of return is as the name says, weighted by money. So for example if you invest $1 for 10 years, then at the end of the 10 years invest $99999 more and wait for another 10 years, money-weighted rate of return tells principally about the period where you had $100000 invested and practically nothing about the period where you had $1 investment. Time-weighted rate of return considers both periods equivalently important.
I use money-weighted rate of return for my stock investments because I don't have enough historical price information for all ~100 stocks in my portfolio.
Just for fun, I also import regularly information from a global stock total return index and calculate time-weighted rate of return of the index for the period for which I had calculated the money-weighted rate of return. Then I compare this time-weighted index rate of return into a hypothetical money-weighted index rate of return that tells how my investments would have performed without active stock choosing just by investing into the index (this hypothetical money-weighted rate of return has all cash flows being the same as with my real portfolio, with the exception of the current value of the portfolio which is calculated based on the index). The difference tells how well I have timed my stock investments into market lows. Currently the time-weighted index rate of return is about 1% lower than the money-weighted index rate of return, telling that I have succeeded in timing the market.
A nice feature of time-weighted rate of return is that you can draw a chart out of it. Money-weighted rate of return, being just one number for the whole investment period, cannot be charted.