Selling a stock at a loss can offer tax advantages. The loss may offset a capital gain or might be deductible against other income.

However, after you take a loss, you can’t buy back the same stock right away. If you repurchase the same stock within 30 days, your tax loss won’t count.

Instead, you can buy a similar exchange-traded fund (ETF) immediately. Suppose, for example, you take a loss on a bank stock. Without any waiting period, you could reinvest the sales proceeds in an ETF such as Financial Sector SPDR (XLF), which tracks the S&P Financial Sector Index.

Such a purchase would not violate the “wash-sale” rules so you would not lose the tax loss. You will still be in the financial sector so you can profit if bank stocks rise. If you wish, you can move back into your original stock, 31 days later.