@HACKITOFF Thank you very much! If I understand correctly, I should not buy any more stocks after selling last year stocks in next 30 days. You are saying I should not buy any shares before or after 30 days, then what about last week's trading of same stock? As I mentioned still I did not sale last year's stocks But now I am planning to sale them. Before selling I wanted to make sure that will not come under wash sale.
I think you are a bit confused ... wash sale rules only come into play when you sell at a loss ... and you bought for 20 and sold for 22 so no loss incurred. Now if you sell the shares you bought at 30 for 30 then again you have no loss (or gain) the sale breaks even ( some call it a wash ... but this is not the same thing as wash sale rules). Even if you sold the stock at a loss now you would only trigger the loss sale rules if you buy the same stock again within 30 days of the sale.
Talk to your broker ... they keep track of these basis items for you automatically.
first sell is a profit only if you are doing Last in first out
in that case second sell of 30 shares must be presumed to be at 22 not 30 so that would be a loss.
since 15 shares were bought within the wash sale window the loss on 15 of the 30 shares would be disallowed.
however the basis of 15 shares of the first sale at 22 would be adjusted so the loss ends up not disallowed after all.
More likely it is FIFO, and the first sale has a loss out of which the loss on 15 shares is disallowed. it is a disallowed loss since the second lot was purchased two days before the sale of half the first lot which is within the wash sale window
Note that unless there was a broker instruction in place, the default assumption is FIFO. Hope @madhukar-killams indeed instructed the broker to use LIFO i.e. sell the $20 batch and not the $30 batch. Also thought the wash sale window starts after the sale of a lot i.e. it is a 30 day window post sale of a lot and not +- thirty days of a sale.