Time Weighted Return

You could also have a look at this solution by @Cowboy13