“You can’t time the market.” -- The first and last rule of investing.

Trying to figure out the precise moment when to buy into the market is nearly impossible. A market that has recently risen higher can keep rising, or it can just as easily pull back.

But there are indicators that can help, as long as you know what to look for. To get a broader sense of the market’s future direction, check out where stocks stand in relation to history by looking at several key ratios.

While they are very helpful, they aren’t perfect. These key ratios may flash red and tell you it’s time to sell, and the market can still climb higher, as was the case in 1998.

The opposite can occur as well. The market may look as dirt cheap as it did in 2008, and fall yet lower.

But over the long haul, the stock market “reverts to the mean,” which simply means that long-standing rules of what makes a “cheap” or “expensive” stock market eventually determine the market’s course.

So what are the measures and what are they telling us now? Here are five indicators that can help you determine if the stock market is currently a bargain or a bear trap.

1. Price-to-Earnings Ratio (P/E)

This is the most common measure of the stock market because it measures a major index -- such as the S&P 500 -- against the aggregated earnings of companies in said index.

For example, at the time this article was published, the S&P 500 Index is trading at 1,338, and companies in the S&P 500 are on track to earn a collective $103. That means that the market is valued at 13 times projected 2011 profits.

That figure moved below eight in the early 1980s, which was indeed a signal that the market was very inexpensive. The S&P 500 rose from 107 in July of 1982 to above 1,500 in the summer of 2000 -- a stunning 15% average annual return for nearly two decades.

Conversely, the S&P 500 had a P/E ratio of nearly 25 in 2000 after a tremendous surge, making it hard to justify any further gains.

Fast forward to 2011, and the S&P still has yet to get back to that 1,500 mark. Currently, our P/E ratio of 13 stands just below the average P/E ratio of 13.6 over the last 25 years.

Using this measure, the current stock market is neither cheap nor expensive and its future direction will be determined by economic growth.

line(6)

2. Free Cash Flow Yield

Companies generate positive operating cash flow almost every year. After deducting funds to pay for maintenance of their equipment, investments in new businesses and facilities, the leftover money is known as “free cash flow.”

As an example, television service provider DirecTV (NYSE: DTV) generated $2.8 billion in free cash flow in 2010, and analysts expect that figure will rise even higher this year and next.

Many investors like to see where their free cash flow stands in relation to the company’s stock market value, which is currently $40 billion. That works out to a free cash flow yield of 7% (2.8/40).

A 7% yield compares favorably the yields offered by bonds and CDs. So by this measure, stocks like DirecTV look quite appealing.

Cisco Systems (Nasdaq: CSCO), with $9 billion in free cash flow and $85 billion in market value, looks even better, with a free cash flow yield above 10%.

There are no handy tools to know the free cash flow yield of the S&P 500, so this measure is best used for individual stocks.

A number of stocks sport free cash flow yields in excess of 5% or even 10%. Those are certifiable bargains – if free cash flow levels can be maintained.