I believe what you are referring to is a wash sale, for losses. This is the rule:
"After selling a security at a loss, you must wait 31 days to repurchase the same or a substantially identical security to avoid triggering the wash sale rule. The rule applies to both 30 days before and after the sale, meaning a total of 61 days must be considered when planning trades to avoid a wash sale"
There is no rule that says you must wait to repurchase for 30 days. You can repurchase any time you want, but there are tax penalties associated with that.
This does not apply to selling a stock at a profit and rebuying when the stock drops.
GLTY