Be aware that the rules on what is substantially identical are subject to IRS rulings that make them quite tricky.
Imagine, for example, you wanted to book a loss on gold while staying in the market. The SPDR Gold Shares ETF (GLD) is trading around $116 a share, up 20 percent this year but far below the peak of $177 in 2011, or even this year's high of $129 in July. So an investor who bought GLD during a period it was higher could book a nice loss now.
Gold investors "have done pretty well this year but are still sitting on a loss," said Ed Coyne, executive vice president at Sprott Asset Management USA, a registered investment advisor based in Carlsbad, California, and an affiliate of Sprott, a global alternative asset manager. The firm manages the Sprott Physical Gold Trust (PHYS), an exchange-traded trust that represents ownership of gold bullion stored in the Royal Canadian Mint.
Coyne said investors who sell GLD can buy PHYS to stay in the market. Sprott believes they would escape the wash-sale rule because PHYS is a closed-end trust, while GLD is an open-ended fund — they are not substantially identical. (As a bonus, gains in PHYS are taxed as ordinary capital gains, at rates of 15 percent or 20 percent for long-term holdings, while GLD gains are taxed at the 28 percent rate on collectibles, Coyne said.)
Of course, in a similar case, the IRS may not feel that two very similar securities are different enough, so investors should be careful about treading a fine line.
3. Buy a call.
A call stock option gives its owner the right to buy 100 shares of stock or an ETF at a set price for a given period. If the stock or ETF rises in value, the call contract will go up as well. So the investor who sold XYZ for a tax loss can buy a call on a similar but not identical security to stay in the market. Because options cost far less than the underlying security, buying one contract would cost a fraction of the cost of buying 100 shares of the real thing.
Here's where it gets tricky: You could instead buy a call on XYZ itself rather than something different, guaranteeing your stand-in would track XYZ exactly. A call on the same holding you sold would be considered substantially identical, so the loss on XYZ could not be taken if the call were purchased within 30 days before or after the sale.
But the strategy could work anyway by effectively switching the loss to the call, said Robert N. Gordon, president of Twenty-First Securities, a brokerage in Manhattan.
In his example, an investor who bought XYZ for $50 sells at $30 for a $20 loss. At the time of the sale, the investor buys an XYZ call with a strike price of $35, paying $1 a share and gaining the right to buy 100 shares of XYZ for $35 each to ride a rebound.
The investor cannot claim the $20 loss on XYZ, because of the call purchase, but can add that $20 to the cost basis of the call, raising its price for tax purposes to $21. If the call were then sold for $1, the investor could claim a $20 loss on the call instead of claiming it on the XYZ shares sold earlier.
This move would also allow the investor to buy back the XYZ shares as soon as the call is purchased, to stay in the market, while still staying clear of wash-sale problems, Gordon said. He added that to avoid being substantially identical, the call must be "out of the money" — have a strike price higher than the price at which the security is trading.
"I think a lot of people try to do loss harvesting and probably would be well served to understand what the rules are before they do," he said. "You have to be correct."
— By Jeff Brown, special to CNBC.com