By John Wasik

(Reuters) – For many investors who have stayed away from the stock market for the past four years, this is a Hamlet moment. Returns look so tempting right now as stock indexes show their best performance since May 2008, with technology shares leading the way. To invest or not to invest?

Fortunately, you can take a Polonius approach to the market. He’s the father of Ophelia and Laertes who gets stabbed by Hamlet while spying on the vengeful prince of Denmark. Despite his bad timing, he has some great advice: “This above all: To thine own self be true.”

I’m reminded of Polonius’s speech by the notorious bear money manager Jeremy Grantham, who counsels long-term patience and resilience in a recent newsletter. While Grantham is bullish on “high-quality” (dividend-paying) stocks, oil, copper, forestry and farmland, I’m not suggesting you jump into anything before you do some serious self-analysis.

How do you be true to yourself? You need to lay down a set of investment principles and goals — if you haven’t down so already. When do you want to retire? Are you saving for college? Do you have to take care of an elderly relative? How much risk can you tolerate in the form of annual losses? Once you’ve answered these questions, write them down. This is your template for asset allocation.

COOKING LESSON

Your asset allocation is like making a pie. In fact, when you’re done, it should look like a pie chart with each portion of stocks, bonds, cash and other investments graphically displayed. It won’t come out right, though, unless you’ve been honest with yourself.

A self-questionaire will get you most of the way there. I like the retirement asset allocator at Yahoo! Finance (link.reuters.com/buq86s).

Bankrate.com also has a useful tool (link.reuters.com/cuq86s).

The Yahoo tool, for example, asks you about upcoming major expenditures, time horizons, income, age and investment risk profile. Since it’s geared toward behavior and not absolute numbers and market predictions, it tends to focus more on your psychology. Very few people are good at market forecasts, nor should they be.

Based on what you tell these calculators, they will give you a thumbnail asset allocation. Here’s a sample based on my inputs:

* 50 percent stocks, with 15 percent in large-company value, 10 percent in large-company growth, 10 percent in small/mid-sized companies, 15 percent in non-U.S. stocks.

* 45 percent in fixed income, with 25 percent in U.S. bonds and 20 percent in international bonds.

* 5 percent cash in a money-market fund.

Of course, this pretty much reflects my age (54) and how I’ve invested my family’s portfolio. You have to adjust the percentages to your situation. It’s a fairly conservative mix.

I’d like to see more of an allocation to treasury-indexed securities and commodities for inflation protection. I’ve done that in our portfolio, although you probably won’t get this kind of advice from a generic, off-the-shelf tool.

FILLING IN THE PIE

Wait, you’re not done yet. At this point, all you have is the crust and shell of the pie and what it might look like. You need to fill it with something. You can easily create your mix with passive, low-cost exchange-traded or mutual funds. Sites like MyPlanIQ.com, Folioinvesting.com or Betterment.com can help with individual portfolios.

With these pre-packaged portfolios, you can take as much or as little risk as you want. Don’t forget to do some retirement-income estimates as well. There is a plethora of calculators, on every mutual fund and brokerage-firm site.

For even greater customization, you should talk with fiduciary advisers such as certified financial planners, registered investment advisers or chartered financial analysts. Even certified public accountants designated as personal financial specialists can help you craft a personalized plan. These are the kind of professionals you need to consult if your needs are complex and you also need tax, estate and college-planning advice.

Having invoked Polonius’s famous line, I caution you to do what he says and not what he does. Do your homework. Spell out your dreams and fears. Don’t act on impulse just because the market is surging. Invest based on the way you live, not what Wall Street tells you to do. Don’t follow your gut; look at long-term returns.

In other words, don’t stand behind a curtain waiting to hear what you want to hear and end up getting skewered. You don’t have to be a bit player in a tragedy involving your money and future.

(Reuters Editing by Beth Pinsker Gladstone and Andrea Evans)