The wash sale rule only applies to capital losses. If you sold stock at a gain and later had another similar transaction with the same or a substantially identical stock, the wash rule would not apply to those exchanges.