You can offset some or all of the tax burden from your stock market gains by selling off any losing investments within your portfolio.