A currency crisis, political turmoil and an economic policy-making vacuum are not usually favourable conditions for a stock market bull run but one is underway in Egypt nonetheless.
The Egyptian market has soared over the last few weeks even though the immediate political and economic outlook for the country has darkened. Sustained buying by foreign funds has helped to push up stocks.
The rally illustrates how many investors in countries hit by the Arab Spring uprisings are looking beyond the current turmoil to a point, perhaps a year or two from now, when politics may be more stable and economies are again growing solidly.
Foreign investors are not ignoring Egypt's troubles but they think the problems can be managed over time, so they are focusing on the country's potential, said Sherif Salem, portfolio manager at Abu Dhabi's Invest AD.
"Investors realise more and more with time that the political and economic issues will follow a very volatile trajectory, given the experience we have all been through over the past two years," he said.
"But with the long term in focus, investors are looking beyond the short- and medium terms."
The last several weeks have given investors plenty to worry about. President Mohamed Mursi's decision to fast-track passage of an Islamist-tinged constitution outraged the opposition and may complicate efforts to reach a cross-party consensus on economic reforms.
These reforms are needed to persuade the International Monetary Fund to provide a $4.8 billion loan to Egypt, to arrest a slide in Cairo's foreign reserves. An IMF decision on the loan was postponed indefinitely because of the political turmoil.
The precarious reserve position prompted Egypt's central bank to abandon efforts to keep the Egyptian pound steady. It launched a new system of foreign currency auctions that has allowed the pound to depreciate over 4 per cent since Dec. 30, to a record low of 6.48 against the dollar.
More depreciation is likely; Capital Economics, a London-based consultancy, thinks 7.5 would be fair value for the pound. A weak currency threatens to trigger capital flight from Egypt, saddle foreign investors with exchange losses and fuel inflation that would worsen the country's political problems.
But such considerations have not hurt the stock market. The main index is up about 25 per cent from a low hit in late November. It is still 18 per cent below its level at the end of 2010, just before the revolution which toppled Hosni Mubarak, but up 64 per cent from the post-revolution low of December 2011.
Non-Arab foreign investors, who account for around 15 per cent of trading in the market, have been net buyers of stocks on almost every day in the past six weeks, exchange data show.
Zin Bekkali, founder and chief executive of Silk Invest, an emerging markets investment manager, said foreign funds were gradually building back normal weightings in Egypt after essentially pulling out during the chaos of 2011.
"Now global emerging market funds with small Egypt exposures have generally gone back to neutral on Egypt. But regional- focused funds are still in the process of doing so - this process partly explains why the market has been so strong in the last few weeks, and it could continue for some time," he said.
The uproar over the constitution has sparked some violent street protests. But many fund managers can accept a fairly high level of social unrest, as long as it does not seem to doom Egypt's slow transition to more stable politics.
"You have to fight not to get preoccupied by the politics - don't fall into that trap. It's difficult, but you have to accept that volatility is part of the market," Bekkali said.
In one way, Mursi's aggressive move on the constitution looked positive to some investors: it cleared the way for parliamentary elections in a few months' time. The elections, however messy, are a key part of the political transition.
Meanwhile, the economics of currency depreciation are not totally negative. Foreign investors seem to be using the lower pound to buy stocks at cheaper prices, while inflation caused by currency weakness may erode the real returns of bank deposits, forcing local investors into stocks over time, Salem said.
Shares in exporters such as Ezz Steel, which could sell more abroad with a lower pound, and property developer Palm Hills Developments, which could benefit if a cheap pound encourages wealthy Gulf investors to buy Egyptian real estate, have outperformed the market in the last few weeks.
The big danger for stocks is an uncontrolled collapse of the pound which, because Egypt imports much of its food, could push inflation to politically explosive levels.
But investors believe a collapse is unlikely, as they think Egypt will eventually obtain the IMF loan while other foreign donors such as Qatar, which this week announced $2.5 billion in aid to Cairo, have a geopolitical interest in supporting Egypt.
Nancy Fahim, regional economist at Standard Chartered in Dubai, said Cairo was likely to have enough reserves to manage the pace of the pound's drop and limit the rise of inflation.
"I think they will avoid chaotic depreciation," she said, predicting inflation would rise to 8.5 per cent next fiscal year from an average of 7.7 per cent in the current year through June. Last fiscal year, it was 8.7 per cent.
Egyptian stocks have thrived alongside a weak currency in the past; in 2003, when Cairo launched an earlier policy of controlled depreciation, the pound fell about 25 per cent but the stock index shot up 135 per cent as export-related shares soared.
Bekkali, whose company has about $25 million invested in the Egyptian stock market, or roughly 20 per cent of its regional African and Arab equity investments, said stocks were trading at around 10 times companies' estimated earnings for 2013, with earnings expected to grow about 20 per cent in the coming year.
"That would imply about 40 per cent upside for the market from its current level," he said.