A. You want to use the loss to offset your high income. So the best time is to sell is right before your retirement.
The Tax Law
The Tax Reform Act of 1986 allows taxpayers to deduct some losses against earned income. You can deduct $25,000 in losses if your modified adjusted gross income is less than $100,000 (for married couples), such deduction starts to phase out after that; it is completely unallowable at $150,000.
But if your income is so high that you can't deduct any loss at the same year as it occurs, you can use these losses when you sell the property. In the year that property is sold, those accumulated losses can be used to offset any earned income.
The Best Time to Sell
The best time to sell is in a year when your income is high. You don't want to release those losses in a year when you have poor income, such as after your retirement, because once you release them, they're gone.