I should mention that I am not a financial advisor and that I haven't been particularly religious about investing. As I said, there were times I've had to sit on the sidelines because of lack of income, expected lack of income, or a need to use funds for something else. But I've never tried to "time" the market and I haven't tried to pick individual stocks in decades.
That out of the way, one would think the more frequently you invested, the more you'd "smooth" the profile and the less likely you'd be to buy overvalued stocks. And the way things are looking with inflation and a GDP contraction last quarter, it may be a hard road to walk for the near future. Looking back at the pandemic, my Darden shares were sitting at $117 in February 2020. They were $43 two months later. But within a year they'd recovered, getting to a recent high of $144 or so, but as I typed this, I see they're down to $130.
One more thing: The only reason I'm doing real estate investing is for the cash flow. A $100,000 investment in stocks may be worth $150,000 five years later (or at least it will have a lot less work and headaches, IMO), but even $150,000 in stocks isn't going to gross you $12,000 a year like a rental can (that's a bit of a simplification because I should whack off taxes, maintenance, insurance, and management fees). The other reason real estate wins over stocks, IMO, is that you can use leverage to build wealth. With stocks, after the Great Depression, they limited the amount you can borrow to invest in stocks to something like half your portfolio. So you've got to have money to play. With real estate if you're smart and lucky you can build a literal "house of cards": You get money from a "hard money" lender to buy a rental, fix it up and get it rented. Once it's rented, you can get a regular bank mortgage to finance it. And you get some extra money because the house is nicer so it is worth more than you paid for it. Then you repeat the process for as many times as you're comfortable with. Your renters pay off your mortgages and you keep the houses until you're ready to sell them. There's no way to do that with stocks.