Learning to master your emotions takes a great deal of knowledge. You have to learn how to read fear and greed in the markets and recognize the opportunity when these emotions run rampant, suggests Dennis Slothower, editor of Stealth Stocks.

By investing during the darkest days of the 2008 financial crisis, Warren Buffett earned billions of dollars for the shareholders of Berkshire Hathaway. Explaining this, he said, “You want to be greedy when others are fearful. You want to be fearful when others are greedy. It's that simple.”

It was just another one of those times when he adhered to one of his many investing maxims. It may certainly sound simple, except that for most investors, it's emotionally hard to do.

One of the keys to successful investing is to have a temperament that allows you to buy when others are selling and sell when others are buying. The more you appreciate this, the better you'll be at staying the course and acting on opportunities.

We are being conditioned to believe in the Bernanke put—that the Fed can't taper and will continue to provide liquidity, even if the economy stalls and then contracts.

Because the Fed wants to give the impression that it is predictable and will always come to the rescue, more and more people have leveraged their stock holdings by using margin in order to maximize returns.

One of the best measures of greed is that people are willing to borrow money to buy stocks...and right now, it looks to me like greed is running rampant on Wall Street.

One way to determine whether investors are greedy or fearful is to measure the margin debt levels compared with other historical extremes.

This is found by calculating the credit balance as the sum of free credit cash accounts, and credit balances in margin accounts, minus margin debt, to compute whether there is a positive credit balance (defensive posture) or a negative credit balance (aggressive posture).

Currently, in spite of all the crazy things that have happened this year, we have the second-highest negative credit balance, or margin debt balances, ever recorded. The highest margin debt balances led up to the tech bubble seen in the first quarter of 2000.

We are now approaching these same bubble extremes again. So, not only are P/E ratios soaring, but investors are reaching margin levels last seen during the dotcom bubble.

Momentum investors are betting big on the fact that the Fed will have to keep providing liquidity to its primary dealer banks, even if the economy wilts.

We do not know when the Fed is going to stop QE or when this bull market is going to end. However, Warren Buffett's point of buying when others are fearful is a key principle of investing, specifically when it comes to individual quality businesses we would like to own when the price becomes a bargain.

While the major market indexes have made all-time new highs, the market breadth has not been particularly impressive this year.

This is because economic growth hasn't been good this year. The headwinds working against the economy are motivating the Fed to stimulate the economy, but fewer and fewer stocks are supporting the rally, as stocks become increasingly more expensive.

Seasonality tells us that the period from November to April is a bullish one. Investors seem to be piling into this trade, hoping to catch a year-end rally.

In a sense, fear of missing out is playing with people's psyches. This is why investors are betting the farm on higher prices, as they use their margin accounts.

Even though earnings and revenues have deteriorated from the previous quarter, and the government shutdown will weigh on economic growth, investors seem to believe that Fed Chairman Bernanke has their back.

It is also important to note that the AAII sentiment survey is now showing the lowest amount of pessimism regarding the stock market in 21 months, and the highest optimism in ten months.

Bearish sentiment has fallen below its historic average of 30.5% five times in the past seven weeks. Heaven help us when the Fed does decide to taper. All I can say is watch out below.

Subscribe to Stealth Stocks here…

More from MoneyShow.com:

Bearish CrossCurrents

Coppock Curve: Caution Sign?

Dow Theory: Unequivocally Bullish