It's time to think ahead and decide in advance what circumstances would cause you to make this error again. For example, all of the following are very likely to occur within the next five years:*
-Riots
-A recession and/or correction over 10%
-The U.S. will start or enter a war.
-An act of terrorism
-Political turmoil, power struggles, and crimes
-A disputed election
-Rising oil prices
-Either rising inflation or the risk of deflation
-Great Orange Dictator will tweet something distressing and set off a panic
If any of these events would cause you to hit the "sell" button, you'll be hitting "sell" quite a few times in the next few years. Thus, you're already set up to sell low and buy back high, just like you're doing today. It is your destiny because of your current mindset plus being invested in volatile equities. The goal state is to stay invested in an appropriate-for-you portfolio regardless of what happens. Even better if you can set it and forget it, and focus your energies on growing your earning potential and saving more money. Build a spreadsheet and note the difference that saving an extra $5k a year makes vs. earning an extra 1% by successfully timing the market against all odds every year. At this age, focus on income. When I was 28 I was trying to time the market to make or save the amount I now deposit each week! What a waste!
Use this episode as a motivator to learn more about the history and functioning of markets, investments and their pros/cons, behavioral finance, discounted cash flows, securities analysis, bonds, scams and fallacies, etc.
Finally, there is a way to get back in the market and earn back what you lost today. It's selling an at-the-money put! But that's NOT a strategy for someone who hasn't done the homework described above.
*(note that all the bad things described above occurred within the LAST 5 years).