What is the problem, if any, of selling when it goes up 2% and then buying back in when it goes down 2%?
The problem is when the market goes up 10% and you cashed out at 2% because you thought it was going to go back down. You miss out on that 8% upswing waiting for that 2% dip that just isn't happening. On the other side, you buy in on a 2% downswing, but it keeps going down by 10%. Odds are good that the market will eventually come back up, and if you are patient, no loss. But this side works because you are in the market, rather than trying to time it.
"But wait! I won't cash out at 2% upswing if it's still going up!" Ok, fine. You wait for a "peak". You'll cash out when it goes up past 2% of your basis, but then ends the day down. Of course, just one down day will boot you out of your position, even though it could zoom up another 10% right after.
"Ok, I'll be smarter at identifying the top. I'll use technical analysis and look for support, shoulders, etc." Well, you can see where this is going, I hope.
Just to give an idea of how hard it is to know when to buy, I was hoping to buy into the bottom of the market. If I had a crystal ball, I would have seen that the bottom was on March 23rd, where the DJIA had lost more than 30% off its high water mark for the year. But on March 23rd, I was thinking: "It will get worse, because most states have not reached their covid-19 death peak. Buyer sentiment will sour when soaring death reports roll in." And so when it came back up, I sat it out. Now the market has recovered considerably and remains stubbornly high relative to that low. Fed intervention seems to be buoying optimism. Will it go down again? Will it keep going up? Pretty hard to say.
If you think this is a good idea, implement it as a paper trade. Go back as far as you like, applying your rule(s) religiously, and see how much profit you would have made. In the event that the market oscillates up and down by 2% over a short time period, this strategy is an absolute killer. For other scenarios (i.e., the real world), the net profit is...less clear, as TripeHound explains.
You can download historical prices pretty easily from Yahoo! Finance, such as this data for DJI (click the Download Data button for a nice CSV file). If you have any programming experience, it should be pretty trivial to write a script which implements whatever rule you imagine and executes virtual historical trades to see what your final profit would have been. This is much better than applying a rule manually, because the program will be ruthless and blindly apply the rule even in obviously bad situations. Given that "obviously bad" only applies with the magnifying 20/20 vision of hindsight, it is pretty important to apply whatever rule you invent consistently. This is clearly the kind of process described by TripeHound.