Day trading income is comprised of capital gains and losses. A capital gain is the profit you make when you buy low and sell high — the aim of day trading. The opposite of a capital gain is a capital loss, which happens when you sell an asset for less than you paid for it. Investors can offset some of their capital gains with some of their capital losses to reduce their tax burden.

Suppose you love LMNO Company, but the price of the shares is down from what it was when you purchased them. You’d like to get that loss on your taxes, so you sell the stock, and then you buy it back at the lower price. You get your tax deduction and still keep the stock. How excellent is that?

It’s too excellent to be true. This trick is called a wash sale, and the IRS does not count the loss. The wash-sale rule was designed to keep long-term investors from playing cute with their taxes, but it has the effect of creating a ruinous tax situation for naïve day traders.

See the rule in action

Under the wash-sale rule, you cannot deduct a loss if you have both a gain and a loss in the same security within a 61-day period. (That’s calendar days, not trading days, so weekends and holidays count.) However, you can add the disallowed loss to the basis of your security.

Here’s an example to illustrate. On Tuesday, you bought 100 shares of LMNO at $34.60. LMNO announced terrible earnings, and the stock promptly dropped to $29.32, and you sold all 100 shares for a loss of $528. Later in the afternoon, you noticed that the stock had bottomed and looked like it may trend up, so you bought another 100 shares at $28.75 and resold them an hour later at $29.25, closing out your position for the day.

The second trade had a profit of $50. You had a net loss of $478 (the $528 loss plus the $50 profit). Here’s how this works out tax-wise: The IRS disallows the $528 loss and lets you show only a profit of $50. But it lets you add the $528 loss to the basis of your replacement shares, so instead of spending $2,875 (100 shares times $28.75), for tax purposes, you spent $3,403 ($2,875 plus $528), which means that the second trade caused you to lose the $478 that you added back.

On a net basis, you get to record your loss. The basis addition lets you work off your wash-sale losses eventually, assuming that you keep careful records and have more winning trades than losing ones in any one security.

To make the calculations easier, several different tax software packages can download trade data from your brokerage account to keep track of your tax situation. One to check out is TradeLog. Even if you hire someone to do your taxes, tracking your potential liabilities as you trade can help you avoid costly mistakes.

The wash-sale rule applies to substantially similar securities. LMNO stock and LMNO options are considered to be substantially similar, so you can’t get around the rule by varying securities on the same underlying asset. LMNO shares and shares of its closest competitor, PQRS, would probably not be considered substantially similar, so you can trade within a given industry to help avoid wash-sale problems.