LONDON (Reuters) - A gradual rise by the Japanese yen in recent weeks culminated in a dramatic overnight surge -- firing a warning shot for world markets and the global economy in 2019.

FILE PHOTO: A Japan Yen note is seen in this illustration photo taken June 1, 2017. REUTERS/Thomas White/Illustration/File Photo

Historically, outsized yen gains in short periods, such as the Russian default in 1998 and the global market meltdown in 2008, are a harbinger of stress for global markets. Market watchers say the yen’s latest ascent is a sign that the global economy is set for a rocky ride ahead.

Signs are growing that the global economy is headed for a slowdown. In an environment like that, the yen tends to thrive. Japan’s large current account surplus means global markets consider it a safe haven.

Global surveys this week showed activity in European and Chinese factories are slowing. And falling demand forced Apple AAPL.O to issue a rare cut in its sales forecast, sending tremors through global markets.

The yen’s roaring higher was a sign of just how widespread concern over the health of the global economy had become, said Ulrich Leuchtmann, head of FX research at Commerzbank.

Japanese investors tend to invest a large portion of their savings overseas, then bring the money home during extreme market stress, driving the yen higher.

That outward investment pressure has only surged in recent years. According to Morgan Stanley, foreign investments in U.S. assets has nearly doubled over the last decade to $1.25 trillion -- a sign of the magnitude of the flows that could head back into the yen.

The dollar collapsed to as little as 104.10 yen JPY=EBS, its lowest reading since March 2018 in early Asian trading, before recouping some losses to stand at 107.64 yen. The yen strengthened at least 1 percent against all its G10 peers

At session lows, the Japanese currency has gained more than 6.5 percent in the last five trading sessions and is the best performing major currency since early December.

But even as evidence mounts that the global economy is struggling, central banks, led by the United States, are signalling more interest rate increases are coming. That is raising fears they may be tightening policy too much into an economic slowdown.

“It tells you there is a lot of anxiety and nervousness and concern about a more material slowdown in the economy,” said Bob Michele, chief investment officer and head of fixed income at JP Morgan Asset Management.

Real U.S. interest rates adjusted for inflation are at their highest in nearly three years. Nominal interest rates are greater than dividend yields in U.S., China and Japan.

“U.S. real yields are too high, productivity problems are emerging in China and the glut of global surpluses is falling, exposing structural flaws in developed markets,” said Hans Redeker, global head of FX strategy at Morgan Stanley in London.

GRAPHIC: Japan Portfolio investments - tmsnrt.rs/2AuaiBE

SAFER SAFE HAVEN

Unusually though, this time around, the surge in the yen has occurred a few months after a selloff in emerging markets last summer. That suggests the bulk of Japanese investment is concentrated in developed markets such as the United States.

Between late March and early October, U.S. stocks rose by 13 percent and the dollar gained more than 9 percent against the yen as rate increases in the United States and trade tensions boosted the U.S. currency.

Sam Lynton-Brown, a currency strategist at BNP Paribas in London, said Japanese investors typically held much of their investments in developed markets and the widening cracks in developed markets resulted in the yen’s strongly exhibiting its safe-haven characteristics only in recent weeks.

Morgan Stanley strategists said Japanese investors have stepped up buying of riskier U.S. assets such as equities and credit in recent weeks to capture higher yields. Since 2010, they have added more than $400 billion in U.S. assets, most of it in equities, they said.

With Japan’s financial market still closed for new year’s holidays, the latest moves have been credited to retail investors. Those investors generally behaved like the rest of the FX market bar exceptional circumstances, said Commerzbank’s Leuchtmann.

GRAPHIC: JPY valuations - tmsnrt.rs/2AvJhO7

PAINFUL DISLOCATIONS

Emerging-market currencies such as Turkey’s lira and South Africa’s rand felt the biggest pain.

The lira TRYUSD=R tumbled more than 7 percent overnight against the yen. The rand ZARJPY=R dropped nearly 4 percent. Investors have been nervous about both countries, which rely heavily on foreign investors to plug their gaping current account deficits.

“These dislocations demonstrate the impact of unwinding QE on market structures and it means that the truly more vulnerable markets out there need to watch their back, so to speak,” said Koon Chow at UBP.

GRAPHIC: Lira, Rand vs Yen - tmsnrt.rs/2RuZSLN

Japanese investors, who had cut back on their protection against currency moves, are also expected to take advantage of reduced hedging costs and protect their overseas portfolios from further losses -- a move that market watchers say may be the catalyst for further gains.

“Even if the yen consolidates around these levels in the near term, we think it will continue to strengthen on balance in 2019,” said BNP Paribas’s Lynton-Brown, who expects the dollar to weaken to 100 yen by the end of the year.

For Jane Foley, a currency strategist at Rabobank, dollar/yen at 100 is an indicator of a U.S. economy in recession.

GRAPHIC: USDJPY and CFTC - tmsnrt.rs/2RyqoDS