The standard way is to first calculate the average buy price. There may be other methods but this is what I've used in the past to calculate it.
Year 1, 10 @ $50 = $500
Year 2, 15 $ $100 = $1500
Year 3, say 15 @ 150 = $2250
Avg buy price = (500+1500+2250)/(10+15+15)
=$4250/40
= $106.25
Then calc % gain using the current price and the avg. buy price.