The formula I used for yield per year is "yield / (# of years)". This does not give you the compound interest rate, for that you need 100 * ((yield / 100)^(1 / (# of years)) - 1), I don't know how to take the nth root of a number with Tradingview's scripting language if one of you knows please enlighten me.
This is a conversion chart made with excel. Example when the 20 year chart says 30 it really means 600% gain over 20 years which is 7Xing your investment, this is a compound interest rate of 10.22%
Link to chart ---> https://i.gyazo.com/b23a48ee969ec2b420ff8d003795fe0a.png
Disclaimer: This is for educational purposes only, this is not financial advice.