With the S&P 500 about to end its best month in almost 40 years, many would be happy to cash in gains and start packing for the ski slopes.

But some underperforming investors are being cornered into putting yet more money into U.S. stocks.

The S&P 500 on Friday closed its fourth week of gains and is up more than 13 percent in October alone. But many, including hedge funds, were caught wrong-footed by the rally.

Even though some pullback may be expected next week, the clearer picture after the European deal should give a green light for many of the funds to get back in risk assets, according to Robert Francello, head trader at hedge fund Apex Capital, which manages about $2 billion in San Francisco.

Hopefully we'll be able to see some further gains into the year end, he said.

Hedge funds, among the equity market's power players, are on average sitting on losses of 8 percent for the year according to Hedge Fund Research. Meanwhile, the S&P 500 is up for the year, if only a bit more than 2 percent.

A JPMorgan note to clients following Thursday's 3 percent rally on the U.S. benchmark index argues for a strong foundation for an equity rally into year end, with a 1,400-1,475 target.

That's more than the 8 percent gain hedge funds would need to come out of the red for the year.

If you're a hedge fund manager and you want to put money to work it feels like it has to be on the long side: buying stocks, buying risky assets, said Nicholas Colas, chief market strategist at the ConvergEx Group in New York.

For the moment, you've taken away major risk in Europe and you've replaced it with a potential positive in stock valuations and no double-dip.

European leaders reached a long-awaited agreement to boost the region's bailout fund and struck a deal with banks and insurers who will take a 50 percent loss on their Greek bonds.

A more disorderly default from Greece, and the possibility of sovereign defaults spreading in Europe, were part of the reason the S&P 500 closed its worst quarter since 2008 in September.

The market was also relieved after data earlier this week showed the U.S. economy grew at its fastest pace in a year in the third quarter.

A heavy flow of job market data, capped on Friday by the government's monthly report of job payrolls, will be closely watched to confirm the upbeat macroeconomic trend. A Reuters poll of economists shows employers created 95,000 jobs in October.

EARNINGS AND FED TO POWER ON THE RALLY

More than 100 S&P 500 companies will report earnings next week, with Lowes , Pfizer
and Kellogg among the highlights.

Among the more than 300 that have already posted earnings for the past quarter, roughly seven out of 10 have reported better numbers than analysts expected.

Some expect the Federal Reserve to announce another round of asset purchases -- similar to the quantitative easing plan set up last year that sparked a year-long rally in stocks.

An equities rally following Fed purchases would most likely be led by commodity-related sectors, said Apex Capital's Francello.

The Fed is beginning to lay the groundwork for another round of quantitative easing, so that should also put some wind in the back of risk assets, he said.

CHARTS ALSO LOOK BULLISH

The technical picture is also turning bullish, with the S&P moving this week above its 200-day moving average for the first time since early August.

At 1,285 the S&P faces resistance just below 1,300, an RBC Capital Markets note said, but the year-end trend for stocks points higher.

We're still in a period of high volatility so you can't take anything for granted, said Colas from ConvergEx Group.

Do you buy the dips? I believe that is the case.

(Wall St Week Ahead runs every Friday)

(Reporting by Rodrigo Campos; additional reporting by Svea Herbst; Editing by Kenneth Barry)