It's not the sexiest question in the investing world, but it's easily one of the most important: How do you build a better stock portfolio?

There are two primary ways.

One way is to buy better stocks. An investor rigorously adhering to this approach would constantly analyze individual stocks in an existing portfolio, comparing them with equities outside the portfolio. When a stock outside the portfolio looks like a better future performer than a portfolio stock -- however the investor determines that -- the new stock enters the portfolio and the older one exits.

Another approach is to combine stocks more effectively. Here an investor trades the focus on individual stocks for efforts to find the best combination of sectors and industries. The investor's moves are attempts to stitch together the best blend of stock groups to fit his or her goals.

Ideally, every investor thinks about both of these approaches all the time. But in reality, most of us spend most of our time selecting individual stocks and devoting relatively little effort to overall portfolio design. Certainly, most of my columns discuss how to pick individual stocks, and relatively few deal with how to build the best portfolio.

Why We Often Ignore Larger Strategy

I can think of two reasons for that, one silly and the other regrettably reasonable. First, there's no denying that stock picking is more fun than portfolio construction. So even though academic studies have proved that most investment returns -- perhaps as much as 80% -- come from picking the right stock groups rather than the right individual stocks, investors (myself included) continue to put the most time and energy into picking individual stocks. The sheer entertainment value of picking stocks directs our attention that way. After all, when was the last time you had a really interesting discussion about such portfolio tools as efficient frontiers or risk measurement?

Second, the tools available to most investors for picking individual stocks are much better than the available tools for constructing the best portfolio. I don't know of any Web site that offers advice on how to optimize my equity portfolio for the current market. All that said, before giving up on improving a portfolio's construction because of the lack of formal tools, it's a good idea to consider the "informal" tools that can get us where we want to go.

What "informal" tools? Well, try the performance of the market itself recently. The volatility among stocks during the past two weeks has given investors a tremendous amount of information about how industries and sectors perform in this market. Using the trading patterns of the past two weeks, investors can make reasonable judgments about what sectors are most volatile, about what sectors are fully valued currently, about what sectors are safe, and about what sectors make reasonable hedges for surprising market turns.

Watch These Eight Trends Closely

Here are the eight market trends most important for building a better portfolio right now.

There are big potential gains in heavily shorted technology stocks.

Investors saw that in the

Nasdaq

rallies on May 8 and May 14. Biggest gainers in the May 8 rally of

Cisco Systems

(CSCO) - Get Report

(which took the Nasdaq Composite Index up 8%) included

Broadcom

(BRCM)

, up 11%,

PMC-Sierra

(PMCS)

, up 20%,

Nvidia

(NVDA) - Get Report

, up 11%,

Genesis Microchip

(GNSS)

, up 11%,

VeriSign

(VRSN) - Get Report

, up 13%,

Mercury Interactive

(MERQ)

, up 21% and

Network Appliance

(NTAP) - Get Report

, up 22%.

This trend holds true even if the good news propelling the market isn't about technology stocks. Tech and biotech were big movers on May 14 when the Nasdaq Composite moved back above 1,700. But the good news that day came from the retail sector, where revenue beat expectations.

If you want to outperform the Nasdaq Composite, in other words, place your bets on the heavily shorted technology stocks in the market. That may be a bet you'd rather not make because of the risk, of course, but if you've been wondering why your portfolio has underperformed the Nasdaq index during recent rallies, now you understand one reason.

Technology stocks still have a valuation problem.

Really, really, really good news from

Applied Materials

(AMAT) - Get Report

and the rest of the semiconductor equipment industry didn't do much to move these stocks higher. When a stock doesn't move after the company announces that its book-to-bill ratio (the ratio of new business to filled orders) has climbed to 1.5 after spending months stuck below 1, you know the market has anticipated much of the good news -- and that the good news is already priced into the stock. The same goes for the

Dell

(DELL) - Get Report

conference call last Thursday, when the company raised earnings and revenue projections for the quarter ahead. It looks as if the tech stocks that held up best during the recent selloff aren't yet ready to move steadily higher from here.

Beaten-up big-caps aren't moving up yet.

Companies like

AOL Time Warner

(AOL)

,

General Electric

(GE) - Get Report

and

Pfizer

(PFE) - Get Report

didn't move in the early stages of this rally; in fact, they lagged the market as a whole. But on the last day (May 17) of a weeklong rally, these stocks outperformed the averages, rising 6%, 5% and 4%, respectively. The jury is still out because Friday was a day with heavy options expiration action, which always introduces a short-term dynamic unrelated to any larger trend. Still, it's possible that the longer this rally lasts, the better these big battered blue-chips will do on a relative basis. It's worth watching anyway.

Decimated big-caps aren't recovering.

Below the beaten-up big-caps, decimated big-caps (or at least former big-caps) such as

EMC

(EMC)

,

JDS Uniphase

(JDSU)

and

Juniper Networks

(JNPR) - Get Report

, didn't budge much at all in this rally. Based on the performance of the past two weeks, there's a good chance that stocks like these will remain dead money unless the market takes off in one of those lifts-all-boats rallies. And I think that's unlikely right now.

Drug stocks offer no safe haven.

The drug sector has taken a pounding recently on a variety of bad news. Among the developments: Food and Drug Administration probes of manufacturing standards at

Schering-Plough

(SGP)

, continued investigations into drug pricing, charges that channel stuffing at drug wholesalers has distorted sales figures, and a steady stream of delays on new-drug approvals from the FDA. Despite Friday's bounce in drug stocks, the industry-specific bad news makes this sector unattractive as a safe haven in this market. If the economy heats up, sectors with stronger cyclical growth stories are better choices. If the economy stalls, drug stocks still won't be attractive because of these sector problems. In the near term, this group doesn't offer its usual combination of safety and growth.

Retailing serves as the market's safest haven today.

At the moment, retailers, riding a string of positive numbers, look as if they're set to assume the traditional role of the drug sector in this market. Certainly,

Wal-Mart

(WMT) - Get Report

,

Lowe's

(LOW) - Get Report

,

Home Depot

(HD) - Get Report

and turnaround story

J.C. Penney

(JCP) - Get Report

are turning in reliable growth. Watch for earnings from Lowe's, Home Depot,

Target

(TGT) - Get Report

and

AutoZone

(AZO) - Get Report

this week to cement that role for the retailing sector. One interesting trend to watch: Some "early" money has recently moved away from shorting technology stocks and into shorting retailing stocks. More of that and we could see volatility pick up in this sector.

Energy stocks remain a good hedge against Mideast turmoil.

The energy sector received a load of bad news recently as Russia, the world's No. 2 oil producer, said it would increase oil production. That gave investors a chance to watch a real-world stress test, as the sector responded to the negative report. The stocks certainly fell, but the domestic exploration and production companies such as

Apache

(APA) - Get Report

,

Anadarko

(APC) - Get Report

,

Devon Energy

(DVN) - Get Report

and

Burlington Resources

(BR) - Get Report

didn't hit the skids.

That downside strength is important for any investor thinking of using energy-producing stocks as a hedge in this market. A supply disruption in the Middle East would send the overall market tumbling but energy stocks rising. So buying energy stocks is a hedge against that possibility. What's the cost of that hedge? It's possible that energy stocks will go down with falling energy prices. But the premium seems reasonable after last week's actions -- especially because energy stocks would also rise if the economy picked up strength.

Some sectors are best broken down into subsectors.

For example, among financials, big banks such as

Bank of America

(BAC) - Get Report

and

Wells Fargo

(WFC) - Get Report

, without substantial exposure to the brokerage and investment banking segments, are doing quite well. That's in contrast to big institutions such as

Citigroup

(C) - Get Report

or

Merrill Lynch

(MER)

that are lagging exactly because of their market-leading positions in those segments.

Potential Action Items

What does all this tell you about building a better portfolio? Here are some potential strategies suggested to me by recent market activity.

If your goal is to beat all the indices in a rally, you'd better add to your holdings of heavily shorted technology stocks. That's a kind of all-or-nothing bet that I'm not willing to make myself. Right now the Jubak's Picks, considered as a portfolio, are positioned to perform, on recent numbers, somewhere between the Nasdaq Composite and the

Dow

industrials. That's about enough risk for me in this market.

You can get the same kind of portfolio improvement -- without the risk -- by removing some of the deadwood from your portfolio. By this point, it's clear that some technology stocks, especially those with heavy exposure to the telecommunications business, will recover at a substantially slower pace than the rest of the sector.

If you're looking for safety and growth, adding retail stocks to your portfolio is a reasonable move right now. Only if consumer spending stalls will these stocks go into a spin, and that seems unlikely on the numbers right now. Retailing should continue to outperform the market until the economic recovery proves itself a little more. (I think the early money that has started to short this sector is early, indeed.)

And if you're looking for a hedge on the unexpected, shares of energy producers provide solid insurance at a reasonable premium.

These aren't the only strategies an investor can derive from the patterns of the recent volatile market. In fact, the strategies you come up with for constructing a portfolio depend heavily on your investing time horizon. For example, an investor with a very long horizon -- say, a classic buy-and-hold investor -- could see this as the time to add drug stocks to a portfolio in order to ensure long-range stability. And investors with a time horizon of, say, 12 months, might look to add more low-risk growth to a portfolio by starting to build positions in beaten-down -- but not decimated -- blue-chips.

But whatever your time horizon, the current market volatility has provided new information on how to put the pieces together in the equity portion of your portfolio.

At the time of publication, Jim Jubak owned or controlled shares in the following equities mentioned in this column: AOL Time Warner, Apache, Applied Materials, Citigroup, EMC, Mercury Interactive and Pfizer. He does not own short positions in any stock mentioned in this column.