Any expenses which were deducted from the reinvested dividends but where you were taxed on the gross dividend should also be added to your cost since they were paid with after tax dollars. I purchased with after-tax dollars a variable annuity several years ago, not for a retirement account. An online tax program wants me to pay a penalty for cashing it out last year prior to age 59. I thought I should be paying tax just on the gain. You report the penalty in Part I of Form 5329.
Exceptions apply for death, disability, and substantially equal periodic payments.
The exceptions that apply to IRAs such as higher education, home purchase and medical insurance, don't apply to annuities. I've got a big problem. My reason for not calculating wash sales is that I don't believe I have any pratical ability to do them correctly, there are too many and my 1099 will wind up not matching my Scedule D. Also, based on the sales I have calculated, the wash sales have not affected my tax due as I had a winning year and did not repeatly lose money in one stock. So all losses on those transactions would be allowed. So focus on your open positions and match them to loss transactions you had within 30 days prior to see which might still be disallowed.