The day-to-day moves on Wall Street often don't make a lot of sense. But for those of us investing long term, they don't have to. Pick great stocks to buy and hold for a long time, and you don't have to worry about the daily noise.

But from time to time, there's a stampede on Wall Street to buy or sell something, no matter how irrational it is. In the late '90s it was Internet stocks; during the 2000s, it was mortgage-backed securities; in 2009, it was sell stocks and buy gold; and today, it's a stampede to buy stocks and bonds every time the Federal Reserve extends stimulus.

Logic plays only a small role on Wall Street
Despite weak economic growth, both the Dow Jones Industrial Average (DJINDICES:^DJI) and S&P 500 (SNPINDEX:^GSPC) are reaching new highs, and the Federal Reserve is a big reason why. You can see below that, over the past two years, both indexes are up more than 44%, while the economy has only grown at a snail's pace. What's really happening is that P/E ratios are expanding, pumping up the price of stocks without the help of earnings.

^DJITR data by YCharts

Why is this important? Long term, stocks will trade based on their past earnings and projections into the future. You can see below that over the past 100 years, that brings a lot of volatility to the S&P 500's overall P/E ratio, but historically, it has been between 10 and 25 most of the time, and it never gets out of hand for too long.

S&P 500 Cyclically Adjusted Price-Earnings Ratio data by YCharts

What's interesting about today is that we're not experiencing the growth in earnings or revenue that has normally driven expansion; instead, the rally is fueled by the Fed.

Bernanke keeps stocks moving higher
This week, stocks jumped after the Federal Reserved decided to put off on "tapering" its $85 billion per month bond-buying program. The reason? Unemployment is too high, lower government spending will put a damper on GDP growth, and a jump in mortgage rates over the summer resulted in a quick cooling of the housing market.

In other words, the economy can't stand on its own, so the Fed has to keep stimulus in place, or risk another recession.

This is actually terrible news for companies, and for long-term investors, as well. What investors should be cheering for is strong GDP growth and low unemployment, which will result in better revenue and earnings for companies. So, if the economic news is bad, why are stocks going up?

Here is where the irrationality of Wall Street can become maddening to follow. Traders see stimulus as rocket fuel for stocks, despite the fact that the reason for stimulus is actually bad for companies. Bonds are less attractive when yields are low, and the only thing they can think to do as a response is buy gold or stocks. It may not be logical, but that's why stock markets have done well recently. Bad news is viewed as good news short term.

Long term, fundamentals will win
What long-term investors need to keep in mind is that fundamentals will eventually win. Revenue and earnings growth is what drives stocks long term and, eventually, the market will return to a focus on fundamentals. The Fed may be driving the market short term, but the fact of the matter is that Fed stimulus is bad for earnings and, eventually, that's what should really matter to investors.

Fool contributor Travis Hoium has no position in any stocks mentioned. The Motley Fool has no position in any of the stocks mentioned. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.