Even if you're trying to time markets (bad idea), and even if you think a recession is coming, there's no particular reason why a recession must feature a bear market in stocks. As
this article explains, there have been many U.S. recessions coinciding with bullish stock markets. Using the official recession dates, here are the post-World War II examples (S&P 500 gains):
November, 1948, through October, 1949: +9%
July, 1953, through May, 1954: +18%
April, 1960, through February, 1961: +17%
January, 1980, through July, 1980: +7%
July, 1981, through November, 1982: +6%
July, 1990, through March, 1991: +5%
If you're keeping count, that's 6 recessions coinciding with S&P 500 stock index gains. Since World War II there have been 5 U.S. recessions coinciding with S&P 500 stock market declines. Only two of them were double digit declines: November, 1973, through March, 1975 (the first Oil Crisis) (-13%) and December, 2007, through June, 2009 (the Global Financial Crisis) (-37%).
Basically, if there's a recession, flip a coin. The U.S. stock market is as likely as not to post gains during the recession.