"Iran doesn’t scare investors," traders shrugged last week when asked to explain why the Tel Aviv Stock Exchange's benchmark TA-25 index jumped 10% inside a month.

One of them added: "When the market wants to rise it doesn't look at externalities. But when the market's , people want an explanation. So they've been saying that the market is afraid of an attack."

But that's only his gut feeling. He was ignoring data that can be found, if you only know where to look for it.

Modi Shafrir, an analyst at ILS Brokers – a company that mainly deals with foreign currency and bonds trading – conducted such an investigation. The part that was hard to measure was of course the "Iran attack fear factor," but as it turns out there is a quantitative way to estimate it: the market prediction website Intrade, where futures are traded on weird and wonderful scenarios, such as "Obama will win a second term on November 6."

One of the bets traded on the website is "Israel and/or the U.S. will attack Iran by air by midnight on December 31, 2012."

Fear of an attack on Iran began to explode in October 2011. It spiked in February 2012, abated, and then kept a more or less fixed level until September, when it began to fall, partly due to Prime Minister Benjamin Netanyahu's speech at the UN on September 28.

The stock market's reaction is easier to measure: You simply take a look at the graph of one of the main indexes, such as the TA-25.

But the stock market isn't affected only by the fear of missile exchanges with Iran. It is also, maybe mainly, affected by the fluctuations of the American stock market.

The America effect

To at least partly neutralize the global market fluctuations, Shafrir calculated the gap between the Tel Aviv stock market and American stocks, represented in the chart by the S&P 500 index. This result (represented by the red line on the graph) is compared to the graph showing the bets on an Iranian attack (in green).

The results are interesting.

The graph shows that higher probability of an attack on Iran supported outperformance by the S&P 500 compared with Tel Aviv equities over most of the last 12 months.

Of course, there were other reasons as well, which can be seen by the gap that opened between the two lines from the start of 2012. The analysis doesn't show this directly, but the issues brokers brought up over the year include the underperformance of the local economy in relation to the high expectations at the start of the year, the effect of the social justice protest movement, and anti-monopoly regulation. There were also big problems in the local corporate bonds market (as companies lined up to default), which hit the share prices of the big pyramid holding companies.

The price of futures on an attack

But one thing is especially prominent on the graph.

Four weeks ago it was clarified in an almost unequivocal way that an attack on Iran would not be this year, but maybe next spring. And the two lines on the graph fell hard.

The price of futures on an attack during the rest of 2012 fell directly, and the Israeli stock market shot up against the U.S market, narrowing the gap between them.

The fact that the Tel Aviv index rose 10% in the last month while the S&P 500 index increased by 1% month correlates with the drop in fear of imminent attack on Iran.

So how did this happen in practice? Someone has to absorb this information and generate the demand that will boost share prices.

This is where foreign investors enter the picture. Investment houses catering to foreigners report that some time of foreigners selling Israeli shares, the trend has reversed over the last month, and the industry that interests them more than anything else is the banks. And indeed, the Tel Aviv Banking Index gained 25% this month, lifting the whole TA-25 after it.

Analyzing the performance gaps between the Israeli and U.S stock markets vis a vis the probability of an attack on Iran, and the investors' response to it, teaches the traders and investors in Israel a few important basic lessons.

The first of these is that it is mostly foreign investors that affect the Israeli stock market today.

The Israeli public has been distancing itself from directly investing in shares for a while now. Even the institutional investors are shying away, mainly because they compare their performance with the competition on a monthly basis. Because the proportion of their holdings in stocks isn't high compared with their holdings in bonds, their ranking will not be determined by the stock market – and they treat it as such. Not only that: when trading volumes are low and the number of players is small, any cash flow originating with foreign investors – whether in or out – immediately boosts the share prices.

The second lesson is that fluctuations in the markets have very little to do with the Israeli economy, especially in the short term.

If the fear of an attack on Iran is taken out of the equation and the U.S stock market continues to rise, it's almost guaranteed that the price of the handful of stocks that foreign investors like to hold will also rise, even if the average Israeli citizen feels that unemployment is worsening, his pension savings are eroding, the cost of living is sky-high and the economic horizon is depressing.

This isn't even an Israeli thing: none of the statistical checks of past data for the global stock markets reveal direct correlation between short-term economic activity and share prices.

No it isn't quite a casino

There are those who will say that all this proves that the stock exchange is a casino, a metaphor for a game of chance and luck. This is only half accurate.

Fluctuations of share prices on the stock exchange are not coincidental. Behind every purchase or sale is a trader trying to predict the future movements of other traders –usually on the basis of some type of economic and political analysis – and trying to stay ahead of them.

Today, for example, many traders suspect the western economies will remain sick for a long time, that interest rates will remain at rock-bottom, and that bonds are a dud. The more appealing alternative is to hold the money (with which they have to do something) in shares. The result: the market rises while the economic situation for citizens deteriorates – a phenomenon that is counter-intuitive for most, but definitely not coincidental.

But the metaphor of the casino is correct in another sense: "the house always wins."
The economic situation doesn't matter, and regardless if the markets rise or fall – the people who manage the public's money – like the controlling shareholders of publicly traded companies – will always manage to make hay off the public's back.

This is why they take management fees, trading fees, commissions, make insider transactions, use buy and ask spreads, and employ a long line of tricks of the trade that ensure one of the oldest adages of the business world will continue to be as correct as it ever was: "The best way to make a lot of money quickly is to trade in money itself."