Beyond everything else, the stock market is a test of an investor's ability to read the tea leaves, to divine the future and to know the unknowable.

The rewards for being right and the penalties for being wrong can be staggering -- as we discovered anew last week when waves of panic selling crushed the five-year-old bull market.

Two men who faced the ultimate test of their judgments on the stock market were Don R. Hays and Robert E. Torray. Hays is director of investment strategy for Wheat, First Securities in Richmond. Torray manages $1.4 billion in pension fund and institutional money from his office in Bethesda.

When the market streaked downward last week, the vigorously bullish Hays, who was right on the direction of the market for so long, suddenly found the ground disappearing under his feet. The ever-bearish Torray, who missed most of the gains of the bull market, suddenly found that all of his fears had been unexpectedly confirmed.

Watching the market crack, I wondered what Hays and Torray were thinking. Would Hays be embarrassed to have been caught with his optimism showing? And would Torray, whose performance frequently suffered when he opted for caution, be jubilant to see his warnings come true?

I called them.

"It's been something else," said a weary Hays, who recently dubbed 1987 the "Feel Good Year." He added, "I obviously wish I had sold three weeks ago. But very little has changed."

What was going through his mind last Monday as the Dow Jones industrial average sank 508 points?

"When you have this tornado type of effect, you're too numb to have any feeling," Hays said.

Fortunately, he noted, the folks at Wheat, First are well-mannered and no one suggested he should have warned them that stocks were about to fall out of bed.

In fact, the truest test of Hays' mettle came after the Monday debacle. On Monday night, Hays was scheduled to deliver a speech on investments to a large group of Wheat, First clients. Despite the losses suffered by many in the room, the meeting went well, he said.

"Some people might have wondered if I was going to show up," he mused.

Hays said he knew there was serious trouble in the making after the Dow's 106-point drop on the previous Friday, Oct. 16. He spent the weekend reviewing all the numbers that make up the universe of statistics he monitors.

"The real stress was on Friday and Saturday," Hays said.

As Monday approached, Hays felt his ideas were "on track." But when Monday arrived, it didn't matter. "When you're on track in a hurricane, it doesn't help," he said.

Hays writes a weekly commentary on the market and his new report will be titled, "Bloody But Unbowed." He attributes the market's sudden loses to a variety of factors but lays much of the blame on mutual funds that sold large amounts of stock while engaged in program trading.

Ever bullish, Hays is telling his readers the market will regain its losses within six months.

The world looks very different to Bob Torray.

From his perspective, the stock market decline last week was no surprise. The only surprise was the swiftness of the movement. "I had envisioned a long, steady decline," he said.

Torray doesn't believe the decline is over.

"The market has been grossly inflated," he said, attributing the condition to rampant speculation and the heavy use of borrowed money.

In Torray's view, the Dow at 2700 was a fantasy. At 1200, it would be more realistic but still relatively high. At 900, he would like it a lot better.

"When this is over, they'll wish they had never heard of stocks," he cautioned.

Torray has kept from 50 to 60 percent of his portfolios in bonds, Treasury bills or short-term investments and has been selling stocks for a couple of years. Torray doesn't buy the big cap stocks and, most definitely, doesn't chase the market. He does not like to buy a stock, he says, until it has been "beat to death."

For example, when the oil business was at its worst, oil service stocks were among his favorites.

"I've missed every bull market," he said, noting he has paid a high price in both performance and reputation as an institutional investor.

But he's not sorry for his cautious approach. "The worst thing that can happen is that you make less money. But at least you don't get cleaned out."

Torray considers himself an investor with a "5- to 10-year mentality" and when it comes to the choice between getting out of a stock or chasing it, Torray believes: "It's better to be 10 years too soon, than one day too late."

As the market descended last week, Torray said he made a few small purchases in the depressed areas of regional trucking, thrifts and life insurance.

While the market's descent was dramatic, Torray noted that an investor in his position didn't really have to do much but watch the Dow slide.

Torray's reaction was less than jubilant because he believes the market has far to go before it bottoms at the proper level. But he was optimistic, he said, that the slide may signal a return to basic values and fundamental approaches to investing.

David Silver, president of the Investment Company Institute, which represents the nation's mutual funds, was working at the Securities and Exchange Commission in May of 1962 when the stock market took its deepest slide since 1929. At the time, he was engaged in a special market study and it was extended to include the reasons for the 1962 drop. The staff found that significant signs of weakness had been developing for months.

An investigation of last week's slide may find similar deep-seated problems. "The market has to be in a position to go over the cliff," Silver said. But Silver believes the SEC, which is looking into last week's downturn, should include the role played by computer-based program trading. "They're like the Doomsday machine. These things mindlessly keep going," he said.

Silver said it will take a while to determine whether the huge losses suffered last week will permanently sour small investors on investing in the stock market through mutual funds. He said 80 to 90 percent of the redemptions from mutual funds had gone into money market and bond funds.

Stimulating investor confidence is a primary goal of investment advisers. But that goal was seriously hurt by last week's events, believe two experienced Washington advisers.

Julia M. Walsh has spent 32 years in the investment business and she believes the week's turmoil seriously undermined public confidence in the stock market.

"What was so incredible," she said, "was that the descent was so swift."

The sudden drop in the market value of stocks, coupled with delays in price quotations, caused major problems for brokers and investors, she said.

"Confidence has been seriously affected," she said, "because it left people helpless and people don't like to be helpless." Walsh's firm, Julia M. Walsh & Sons is now part of Tucker Anthony & R.L. Day of New York.

Walsh's son, John Montgomery, senior vice president of Foxhall Investment Management, said, "This week has been the longest year of my life. I didn't believe that what I saw happening was possible." He, too, said he believed investor confidence in the stock market would be affected. Many people would say "I don't care to put up with it."

Other investors would decide that the chance to make money in the market was not worth the continuing fear that the market could collapse, Montgomery added.

Many mutual funds lost considerable value last week when the market fell and stock prices descended. In some cases, investors bailed out. Two funds operated by Johnston, Lemon & Co. of Washington were among those that were hit. The Washington Mutual Investors Fund dropped from $3 billion to $2.7 billion and experienced net redemptions of $7.5 million. The Growth Fund of Washington declined from $60.6 million to $49.4 million and saw net redemptions of about $500,000. Within a couple of days, however, the funds saw their sales improve and outweigh the redemptions, said Harry J. Lister, head of both funds.