Humans are pattern analyzers. We look at the market and see peaks and valleys. But we all agree that eventually the market will go up, which means - assuming you're willing to wait - today's peaks and valleys don't matter. Only the purchase price does.* It feels smart to keep buying as markets go up and foolish to do so as they slide, but when you're selling, those shapes will be meaningless.
If you regularly invest a fixed amount over decades, and then look back on any particular month, the purchases shown in these two graphs will be equivalent. The purchase prices are identical. It doesn't matter which way the market is moving.
Stay the course.
*I'm simplifying by ignoring dividends and taxes. If you're getting dividends, what matters is the absolute price + how long you've had the stock, which just improves the case for buying and holding.