There is no law that prohibits this strategy, which makes it absolutely legal.
Remember this strategy does not guarantee you a 100% win rate.