Last week, stocks closed out on a low note. This week, things have turned around. On the one hand, that's a good thing -- it means any on-paper or on-screen losses you may have seen in your portfolio could, at this point, be gone. But it also poses a challenge -- how do you keep investing when stock prices keep climbing? Now the reality is that a lot of investors agree that stocks are largely overvalued at this stage of the game, and some think a market crash is imminent. But if you're eager to keep investing in the near term, here's how to handle a market where stocks keep going nowhere but up. Image source: Getty Images. 1. Be very selective Your goal as an investor shouldn't be to score the lowest stock price you'll ever get. (Technically, you could set that goal, but you're less likely to be successful.) Rather, it should be to assemble a portfolio of quality stocks that offer solid value and growth potential. As such, you can continue to buy stocks when they're priced higher -- provided you think they'll continue to gain value in time, which leads to our next point. 2. Be in it for the long haul A quick exit strategy is unlikely to work in a market where stock values are consistently high (it's also unlikely to work in general). If you want to keep investing when stock values are up, make a plan to retain those stocks for many years. If you go in thinking you'll dump them in a year or two, you'll set yourself up to lose money, because they may not appreciate in value in that short a time frame. 3. Stay away from shorting stocks When you short a stock, you bet that its value will go down. It's tempting to short stocks that appear to be blatantly overvalued, but doing so could result in serious losses. Just look at what happened to GameStop (NYSE: GME) investors recently. A Reddit thread drove shares of the company up, and many investors had to scramble to close out their short positions, racking up losses in the process. Unless you have an extremely healthy appetite for risk, it's a chance not worth taking. You might think that investing during a stock market downturn is a difficult thing. But actually, in many ways, it's easier to invest during a stock market crash than it is during periods where stock values do nothing but skyrocket. When you're dealing with a broad market decline, there's ample opportunity to score stocks at a discount, but right now, it's a lot harder to identify those truly good deals. The key, therefore, is to be pickier than usual about the stocks you buy, adopt a buy and hold strategy, and steer clear of shorting stocks unless you truly know what you're doing and understand the risks involved. If you follow these rules, you can make the most of an overvalued stock market -- and set yourself up to make it through any downturn that ensues. 10 stocks we like better than GameStopWhen investing geniuses David and Tom Gardner have a stock tip, it can pay to listen. After all, the newsletter they have run for over a decade, Motley Fool Stock Advisor, has tripled the market.* David and Tom just revealed what they believe are the ten best stocks for investors to buy right now... and GameStop wasn't one of them! That's right -- they think these 10 stocks are even better buys. See the 10 stocks *Stock Advisor returns as of February 24, 2021 Maurie Backman has no position in any of the stocks mentioned. The Motley Fool has no position in any of the stocks mentioned. The Motley Fool has a disclosure policy.Source