When you sell you immediately realize the gains. You are limited on your contributions to an IRA per year, assuming it's a roth IRA there is no advantage since you've already been taxed. If it's a traditional IRA you can deduct the contributions from your income. Up to 5K a year if I remember correctly.
I'm not sure about the others, but you will pay taxes unless you contribute something that is able to be written off as a loss.
If you really want to take advantage of an IRA with huge gains your best bet is to invest whatever you intended to use during retirement into a roth IRA before the gains. Then you can use the money tax free later. It doesn't really do you a lot of good to make the huge gains outside of that account and put money into the account, because you still pay taxes when you sell and you're limited to your contributions. Hope that makes sense.