Archives

All posts for the month April, 2015

This follows an earlier post which described why a new entrant into quantitative finance should expect it to be difficult to find a strategy to trade.

Let us assume that the reader has chosen a data set, but hasn’t finalised the details. The next step would be to simulate the trades the program would have made historically, and see whether it would have made money. This is called a backtest, and it is an essential part of systematic trading.

The easiest way to do this badly is through inaccuracy: The backtest might not reflect how the strategy would actually have traded.

Inaccurate backtests

The most common mistakes to make in this scenario are the following:

  • Free rebalancing: The backtest allows the strategy to stay at, for instance, $1M long on Apple from day to day without incurring trading costs. You might think that this would not make much difference, but it does. It gets the strategy free access to a mean reversion alpha (if the price goes up, then the strat have to sell the stock to rebalance and vice versa), and will make money if the strategy is long on average. Unless you treat rebalancing costs accurately, your backtest won’t be accurate. For the more technical reader, note that a simple regression is equivalent to a taking a free-rebalancing strategy’s z-score, so treat simple regressions with suspicion.
  • Forward looking: The backtest uses data that would not be available until after the trade that depends on it. This is normally just a programming bug.
  • The universe was chosen based on current observables. For instance, picking the current largest 100 stocks as your universe. None of the current largest 100 stocks have suffered a calamitous collapse in the last few years, or they wouldn’t be in the largest 100, so you’ve post-selected a biased universe. This will make your strategy look like it would have made money when it wouldn’t have. This is a form of forward looking.
  • T+0: Backtests often use data available at the close of day x to trade at the close price of day x. This sounds like just a tiny change from an intraday strategy that trades with a 5 minute delay, but a lot of strategies appear work at T+0 and not with better assumptions. If the strategy isn’t evaluated with at least the delay that the trading strategy would have, then its predicted performance is not valid.
  • The cost model is wrong. People tend to underestimate trading costs. Often, the trading costs are assumed to be negligible, or it is assumed that once they’ve found a strategy that works, the way it trades can be manipulated to minimise the costs. That is comparable to perfecting the way that you drive 42km, and assuming that that’s a valuable way to prepare for a marathon. The only exception to that rule is ultra-long-term strategies.

These should be avoided, since they’re all problems that can be solved with care. Please note that they all normally make the backtest appear better than real life, not just different.

What a backtest gives us

A backtest provides the reader with a graph of profit/loss (P&L) and other statistics relating to the strategy’s trading patterns, risk profile and performance. The most important statistic, though, is the level of statistical confidence that the average daily profit, after costs, is positive.

This concept can catch people out. It is not enough that the strategy had a positive average daily profit over the backtest, because the backtest P&L might have just been lucky. Instead we use the average daily profit divided by its uncertainty (standard error), and call that a z-score.

The z-score: why P-values are normally wrong

This z-score is often converted to a probability value — which can be interpreted as the probability that a similar but alpha-neutral strategy would do better. However, the conversion is usually done using dodgy assumptions. The usual way to calculate them is to use “normal” or “Gaussian” statistics to do the conversion (and assume no correlation and other things). thermometer_500 However, this is not the only way to convert from a z-score to a P-value and if you use a more accurate way, you’ll get a different value, as shown on the right.

Basically if someone converts from a z-score to a P-value using the middle thermometer (normal distribution), they’re simply wrong. If they use a different thermometer (there are lots), then you have to get stuck in to all the assumptions and distributions that they’re using to make that conversion.

The z-score game:
There are a few pictures below. Each is split into three. The first is a raw image. Either the 2nd or 3rd will also contain the raw image, but both will contain a lot of noise on top. Your task is to guess which has the raw image in it. We’ll start off with an easy example, with a z-score of 36.6.

b_z30_a

You probably guessed correctly: the middle image has the attractor in it, the rightmost is just noise. Now try for these slightly harder examples:

b3tterbanana

b3ttercarrot

b3tterdate

b3tteregg

This problem is not easy. In fact, for this task, it’s fairly likely that you got it wrong. The correct answers are at the end of the blog post. The challenge is slightly unfair: the kind of noise that I’ve added makes large z-scores somewhat more likely than the Laplace distribution would (right thermometer). But a non-technical reader should be able to see that if the noise is badly behaved, then surprisingly large z-scores can happen fairly often by chance.

So, to conclude the last two sections, P-values are normally wrong, and z-scores can be quite noisy: a z-score of 1.5 doesn’t necessarily mean anything.

The importance of this is that the z-score is both our ranking system and our measure of certainty that the thing will make money.

In-sample and Out-sample.

Most strategies will not be optimal from the start, so most research programs allow for some tweaking of the strategy. For instance we might have a threshold for which we would try five different values, a holding period which with four different possibilities, and a couple of other options, like take-profit / stop-loss conditions, and three cap weighting scenarios. The strategy doesn’t seem to work that well for our initial idea, but we try a few others. We have now tried the equivalent of almost 1000 different combinations. Using our image-hidden-in-noise example, we can also try 1000 noise layers, selecting the one with the highest z-score, and we are now faced with the following figure:

b3tterfig

So, which is the “correct” one? Well we couldn’t tell before and we can’t really tell now. It might even be that neither has the mysterious attractor in it. If we use the z-score to get some measure of how likely it is that they contain the attractor, it says “yes” to both: they’re both quite impressive z-scores. The problem is that we know that they only appear to have a high z-score because we kept looking until we saw something that appeared to be good.

For this reason, an in-sample/out-sample approach is taken where the date range is split in two: The first half of the date range is chosen to be the in-sample period. The strategy is optimised in that period. Later, when we want a final evaluation to see if we would trust our strategy to make money, we evaluate its performance in the second half. Since we didn’t fit to the 2nd half, we can’t have over fit to it either.

A common mistake to make here, though, is to try the out-sample period several times: we try one strategy in the in-sample period, and it appears to do quite well, but doesn’t work out-sample. In that case, often, the strategy is abandoned, and the researcher goes back to the drawing board. A different idea is then chosen, and the research program is repeated. The problem now is that if the 2nd or 3rd research programs all use the same out-sample period, then we’ve over used the out-sample period. We might get this figure if we tried 5 research programs:

b3ttergrape

The key point is that they both look really good (even though at least one isn’t). We would trade either strategy with these z-scores.

Another quick point, is that strategies can just stop working, which will mean that even good statistics properly done doesn’t guarantee that the strategy will work.

Conclusion:

It is very important to backtest accurately if we want to avoid wasting time and money on strategies that don’t work in the real world. Backtests give you a z-score which is a measure of certainty that the strategy makes money. The z-score is often converted to a P-value, and the conversion is almost always done wrong: Z-scores have a much larger random range than -1.5 to +1.5. If you try to optimise your strategy, then be aware that you won’t be able to tell which is better, and that the optimised strategy will appear to be better than it is. For this reason, people split their date range into an in-sample period and an out-sample period. Unfortunately it’s almost impossible to avoid over using your out-sample period, which invalidates it.

The good news:

There are several respects in which the picture has been painted as more bleak than it is.

The main one is that how unreliable a z-score is depends on the type of noise you get, and in finance, the noise (for instance the performance of a well-placed bet that turns out badly) isn’t as bad as presented above. It all depends on three things: how correlated the noise is (very correlated in the pictures above, but not that correlated from one day to the next in finance), how fat tailed the noise is (not very in the example above, but quite fat tailed in finance), how much volatility clustering you have (plenty here and in strategy P&Ls). The z-scores in the images above tend to be wrong by around 4 either way, whereas in finance, it’s probably somewhere more like 2. The right-most (Laplace distribution) thermometer in the top graph is probably about right though.

The second one is that even if it’s not possible to be certain that a strategy makes money, a high z-score is still correlated to some extent with strategy performance: A z-score of 3 certainly doesn’t guarantee that the strategy will make money, but it’s more likely to make money than a strategy with a z-score of 0.
To reiterate a point in the previous blog post, it all comes down to the economics: if a strategy has a sound reason behind it, then that counts as additional evidence that the strategy will make money. You should still do backtests, and you should still pay attention to the results, but you should have both in order to have a well informed view of your chances.

Answers:

a: left, b: left, c: left, d: left, e: right, f:right, g: right

The OTAS Tradeshaper Alerts and Microstructure provide statistical intraday analysis of stocks, highlighting to traders unusual market behaviour based on historical data across a range of metrics. Through such analysis, traders can actively determine optimal times to adjust their strategy to maximise order execution prices throughout the day.

Traders of Austrian Bank Raiffesisen(RBI AV) today would have been well served by such information.

OTAS Alert

rbi1

OTAS Microstructure

rbi2

Observations from Microstructure:-

  • Above average volume today in Raiffeisen, driven by early buyers as depicted by Volume & Return Charts
  • High Liquidity Alert fired – Identifies a large concentration of offers forming on the order book (5 x multiple of what is expected at this time)
  • Spread has closed and is towards day ‘tights,’ suggesting sellers are more willing to transact here.
  • ACTION: Buyers may wish to scale back participation here in reaction to this information (Basket also tracking lower so further evidence to adopt a more passive strategy.) Sellers may use the Alert to gain ‘first movers’ advantage and increase their participation.

Result:-

rbi3

A clear reaction to the High Liquidity posted and changing intra-day stock characteristics. Raiffeisen has pared back it’s early gains and trended back towards its bespoke basket (Green Line.) Interesting to now note the spread has widened significantly post the downward move. Are the sellers now stepping away ? Should buyers step back in here ?

For your free trial contact :- otassales@otastech.com

“One of the funny things about the stock market is that every time one person buys, another sells, and both think they are astute.”

William Feather

Breaking Records

European stocks have broken through the decade high 12 month forward P/E as share prices have continued to rise and EPS Momentum across the STOXX 600 has recovered to unchanged, meaning no net upgrades or downgrades in the past month. European shares trade at 17.5x forward earnings. which represents a 30% re-rating over the past six months.

STOXX 600 PE

 

The S&P 500 trades at 18x forward earnings, but historically has commanded a premium over European shares of an average 12.5%. European shares are as highly valued compared with the US as they have been over the last decade. For reference, S&P average EPS Momentum is -0.3% and expectations for Q1 2015 earnings growth are as depressed as they have been since 2009.

STOXX 600 Rel

 

Surveys suggest that equity investors consider markets as overvalued as at anytime since 2000, although in nowhere near the numbers that felt that way in 1999 (and yet still got burned holding on). Many commentators write about the bizarre world in which we pay governments to lend them our money, but when there is a huge, well publicised buyer set against a backdrop of relative fiscal discipline, we should expect investors to front run and to push ever further into ownership of risk assets.

The urban dictionary describes several ways to play the game of chicken. James Dean popularised the version played in two cars, but the site also describes standing on a railroad in the face of an onrushing train, swimming towards a waterfall, or surfing into rocks. I have even seen it played by contestants throwing a knife in between bare feet that must get closer and closer together. In each instant, the person who ducks the challenge first is the chicken; there are no prizes for being sensible.

Markets are always a game of chicken to some degree, and many measures of momentum exist to gauge how far from the cliff edge we might be. Right now investors are feeding off the adrenalin rush of higher stock prices, with the high being most immediate for those in Chinese shares. Yet forward P/E for stocks listed in Hong Kong is only back at the mid level of the last decade; Chinese investors have known a far bigger rush than is being experienced today.

HSCEI PE

 

Returning to Europe, we may use the option market to inform us about expectations for imminent changes in the outlook for equities. Implied Volatility for the average STOXX 600 constituent is 23, indicating a price move of +/- 11.5% in three months time. This measure has not been under 20 and is below the average year-to-date level, albeit rising since the beginning of March.

STOXX 600 IV

 

Stocks with meaningfully higher implied volatility than average, or with a greater degree of uncertainty, include those that have been subject to recent bids, as well as a number of names from the Energy, Autos and Capital Goods sectors. Those with the lowest uncertainty include the bid targets where the terms are known and expected to hold, as well as food & beverage, Swiss and German stocks. No surprises here.

And this is the message from the OTAS indicators; for all the concerns about share prices, from the academic to the emotional, the money being placed in the option, credit and short interest markets is not being positioned for an imminent fall in stock markets. Implied volatility in Europe is in line with that of the US, which is a little elevated compared to the long run trend, but well within normal parameters. The indicators for now say keep on doing as you are doing.

One obvious path down which these indicators point is towards yield stocks. You cannot save for retirement with negative yield and long run stock market returns are inadequate without the benefit of reinvested dividends. In the STOXX 600 there are 29 shares that yield significantly more than usual relative to peers, including 9 banks and 3 stocks each from the capital goods, insurance and materials sectors.

There may be stress in the business models of some of these shares and both backward and forward looking free cash flow cover may be checked using OTAS, but we are looking at Europe’s largest, and hopefully most stable companies. The names at the top of the list, with the greatest divergence in relative yield from where they typically trade, are Sainsbury, AA, Booker, Swiss Life and Shell. RBS is also on that list, so while it yields only a prospective 0.9%, don’t forget it is expected to pay a dividend at last.

Among these high relative yields, there are 4 shares that are also very lowly valued relative to normal versus the sector, using the most industry appropriate valuation method. These are ABB, Norsk Hydro, Generali and Booker.  One more, Direct Line Insurance, has backtested technical support that fired overnight.

High Yield & Signal

 

Backtests of technical signals are carried out over 20 trading days. We are 21 days from the Direct Line sales update.

With WFC and JPM kicking off the Financials Q1 earnings season tomorrow, you can use OTAS to see investor and analyst positioning ahead of earnings.

WFC:

Stock has pulled back slightly vs. the industry over the past week and has lost momentum recently:

WFCWFC perfWFC graph

Analysts have been positive on the name over the past month and five days, however, the stock is still trading below expectations:

WFC epsWFC EPS Graph

Implied vol is on average vs. the industry group. But we see the Upside Skew has come in suggesting people are paying less for upside. The Downside skew is showing bullish positioning as that level is lower now as well, suggesting people are not expecting much downside. The top ten traded volume shows expectations for prices to remain at these levels:

WFC implied volWFC upsideWFC downsideWFC contracts

JPM:

Stock is at recent highs and has regained the 1 standard deviation high vs. the industry group:

JPMJPM PerfJPM Spread

EPS momentum has just turned positive as the stock has re-rated recently:

JPM EpsJPM graph

Implied Vol vs. the industry is on average to normal levels, however, investors are paying less for upside:

JPM Implied volJPM upside

JPM contracts

BAC:

Stock has rebounded vs. the industry over the past week and has bounced off the 2 standard deviation low vs. the industry:

BACBAC perfBAC spread

Analysts have been negative on the name, with the stock still trading below expectations:

BAC epsBAC Graph

Valuations are attractive relative to historical levels and at 0.73x the Diversified Financials, are at a 27% discount to the industry group:

BAC valBAC val 2
Implied vol is also showing the Upside Skew coming down as people are expecting less upside:

bac implied volBAC upsideBAC contract

C:

Citi has gained 1% vs. the industry group over the past week and has turned positive on the month:

CC perf

EPS Momentum has only just turned slightly positive while the stock is still below expectations:

C EPSC graph

Implied vol is flat vs. the industry group but we are seeing the put ratio increasing, suggesting people are starting to transact more in puts. We see the options contract activity is suggesting limited upside:

C implied volC put ratioC contracts

GS:

Stock is also at recent highs and is approaching 2 standard deviations high vs. the industry group.

GSGS PerfGS spread

Analysts have been negative on earnings expectations, but we are seeing divergence between the stock price and EPS momentum over the past month as the stock has recently re-rated:

GS EPSGS DivergGS graph

Implied vol is also showing while investors are paying less for upside, they are still transacting in calls as the put ratio has come down, though expectations for higher prices is low:

GS implied volGS upsideGS put ratioGS contracts

 

 

 

 

The Earnings Positioning view in OTAS highlights potential positive and negative single stock risks ahead of a company’s financial report.  Looking at a range of different indicators, this screen quickly allows users to gauge current share price conditions, market positioning and investor sentiment helping identify opportunities in those shares.

Michael Page is due to report Sales numbers tomorrow. Recent industry peers results have been mixed with Robert Walters beating market expectations resulting in sector leading EPS revisions whilst Hays has seen a slightly softer start to the year versus estimates citing caution ahead of the impending UK General Election.
Year to date Michael Page has outperformed both of these shares by +8% & +23% respectively with current market expectations looking extremely high. Does ‘hire’ mean ‘higher’ ?  Or is too much factored into the price ?

Earnings Positioning View

mpi

Stamp View

mpi1

Considerations:

  • Of the companies reporting in the Stoxx600 this week, Michael Page is the second most overbought stock on its RSI at 73.2.
  • A clear market favourite, the shares are currently +35% YTD and +14% relative to the sector
  • Ratio spread vs sector back to multi-year highs and a previous inflection point
    mpi2
  •  EPS momentum (Stamp) shows a positive 3 month trend, with 1 month revisions little changed ahead of earnings.
  • Historically over the last 8 years, the market has been ahead of forecast to 12m Fwd EPS. Expectations are currently well above trend.mpi3
  • MPI is rated a consensus ‘Buy’. It trades at a +5% premium to its current price target. Comparatively, peers Robert Walters and Hays trade at a 10% & 4% discount respectively
    mpi5
  • One Level A and two Level B directors have sold stock ahead of the release with varying degree of success over 1 & 6 months.
    mpi6
  • Short Interest has decreased significantly from November 2014 highs, the move through March squeezing out remaining directional plays. Note there has been a marginal uptick in the last week.
    mpi7
  • Current 12m Fwd yield of 2.25% is low compared to the industry (over last 2 yrs) but remains well covered.

Using the microstructure effectively: what works and what loses you money?

Too often I am tempted to look only at the basket relative return to see if a stock is underperforming or outperforming to gauge a buying or selling opportunity, respectively, because we know that on any given day the return of the stock should track that of the basket. However, there is very often a very good reason for such a dislocation which often means such a move away from the basket will be on higher than normal volume (e.g. an earnings release, the CEO resigning, a  fraud investigation, a plane crash, peer news flow, a flash crash, an earthquake, a unexpected placing…sometimes there is no news, but be assured someone knows something you don’t!).

Trying to use the basket relative return on such days is basically equivalent to looking purely at an overbought or oversold indicator, rather primitive, backward-looking trader metrics. Why should a stock that is looking oversold not continue to have the bids crunched? The point I am trying to make is that you can use real-time analysis of the order book to better understand what is likely to happen next, rather than looking at historical price movements.

Let us begin then…

…with a Liquidity High alert (“that easy?”, I hear you asking. Yes, that simple we alert you to it!)

ScreenHunter_01 Apr. 08 1  10.56

Here is how I read the following. The stock has started to underperform the basket, with volume towards the higher end of its profile. As the stock trades down new offers are being posted to the top of the order book (hence the high liquidity alert) and the spread is widening notably. So, the most logical conclusion is sellers are being very aggressive and buyers are starting to pull away – a wise move by the buyers. At this point I suspect the stock probably looked oversold on some type of technical metric (there are too many to choose from..try the intraday stochastics).

ScreenHunter_01 Apr. 08 1  20.58

The stock subsequently continued its freefall. On the way down, legacy bid liquidity was discovered (as you would expect), but the tightening spread was a clear indication of sellers happy to continue hammering away at the bids. By this point the stock is looking somewhat more oversold…try the beloved intraday RSI.

ScreenHunter_01 Apr. 08 1  41.00

The share price tried to bounce on the RSI oversold indicator, and as it did the stock was met with more offer side liquidity. The widening spread here again an indication of buyers pulling way, as the price falls. Given sellers now continue to post new offers, as the spread widens, what would you do?

ScreenHunter_01 Apr. 08 1  51.02

Following on from the recent Blog post on British American Tobacco (here) the relative merits of BAT’s vs IMT’s are again looking interesting when comparing the two using OTAS Pair View.

bat1

Performance:
The recent under-performance of BAT’s relative to IMT’s has pushed the ratio spread between the two back out to year lows and close to previous positive inflection points.

bat

The correlation and co-integration matrix indicates strong historic correlation between the two shares and that there is good statistical evidence to suggest that the diverging share prices mean revert over time.

bat2

Valuation:

As mentioned in the previous Blog, BAT’s 12m Fwd P/E valuation relative to the wider Food, Beverage & Tobacco sector currently looks particularly undemanding. Furthermore, when comparing valuation solely to Imperial Tobacco it is trading at its lowest level for 2 years and a level which has offered support recently.

bat3

Other factors:

Risk sentiment indicators CDS & Short Interest are both provide further (relative) support for BAT’s, with a lower perceived default risk and higher days to cover of the short base.

bat4

Contact otassales@otastech.com for a login.

 

The Restaurant Group (RTN LN) suffered a bad run through March after an OK set of full year results on the 27th. February. Previously a potential M&A name – suggested tie up with Mitchells and Butlers (MAB LN), as hinted at by Goldman Sachs and the UK press – arguably now some of this froth has started to dissipate as evidenced by the recent underperformance. OTAS is now highlighting this stock a sector-relative value opportunity, with a well-covered 2.6% yield and technical signals that are highly supportive.

ScreenHunter_01 Apr. 07 1  3031.55

Signals Page

Two historically reliable Stochastic Signals have fired recently.

ScreenHunter_01 Apr. 07 1  3041.58

EPS Momentum Page

Consensus buy amongst sell-side analysts, at a 14% discount to price targets, with price and 12m fwd EPS appearing dislocated.

ScreenHunter_01 Apr. 07 1  3051.58

Stacked Graph Page

Interesting to observe how such lows in sector-relative valuation have coincided with lows in share price. Furthermore, the 200 day MA could now offer some support.

ScreenHunter_01 Apr. 07 1  3061.59

Risk sentiment indicators

Benign risk of short selling currently. Furthermore, the slight upgrades in EPS over the last 1 month are significantly divergent to the price action.

ScreenHunter_01 Apr. 07 1  3102.11

Compared to Domino’s Pizza Group…

EPS Momentum

Domino’s (DOM LN), which trades at a P/E of 25x, is trading in-line with its longer-term trend in EPS estimates.

ScreenHunter_01 Apr. 07 1  3082.01

Performance Page

Going back to 2006 Restaurant Group has underperformed Domino’s Pizza by 233%. However, such historic lows in underperformance have previously offered an inflection point over the following few months, as shown below.

ScreenHunter_01 Apr. 07 1  3092.02

With the Chairman of Chesapeake Energy buying stock recently, are his well-timed purchases enough to convince the market into a turnaround?

Chairman Dunham has been previously well-timed in his purchases of stock. He bought $13.9mm five days ago:

CHK InsiderCHK Insider Dunham

The stock is due to go ex-div on the 13th of April and with a 12M forward dividend of 2.79%, it is flagging as attractive vs. historical levels, a 2-year high, but not expected to remain as not well-covered:

CHK Div Stamps CHK DivCHK Div Cover

The price is down 2% vs. the industry group over the past week and is at recent lows, though has bounced in the past day:

CHK Perf StampCHK Perf TableCHK Perf Graph

Short interest is elevated above 2 standard deviations and the CDS levels are at highs, with both metrics at highs vs. their peers:

CHK Risk

CHK SI table

CHK SI graph

CHK CDS table

 

CHK CDS graph

British American Tobacco is a company where the options market is pricing in a higher than normal move over the next 3 months. BATS is paying up £2.3 billion for 25% of Souza Cruz, a Brazilian tobacco business, which arguably explains why the 12m fwd EPS and price no longer move in sync. However, with sector-relative valuation flagging inexpensive, a high dividend yield in a low rate environment (FYI still covered by FCF), benign CDS and short interest, and technical signals that are supportive, here is how OTAS can help support a fundamentally bullish outlook. Also bear in mind the sales release in 28 days and the fact a company director has recently been purchasing stock.

ScreenHunter_01 Apr. 01 1  2534.24

Stacked Graph

Immediately interesting to observe how the lows in sector-relative P/E correspond to the lows in share price. Secondly, note how the highs in sector-relative implied volatility tend to pre-empt a price move to the upside.

ScreenHunter_01 Apr. 01 1  2513.56

Technical Signals 

The Full Stochastic fired 2 days ago, and historically works 60% of the time (returning 1.4% over the following 20 trading days).

ScreenHunter_01 Apr. 01 1  2554.28

Other supportive factors…

…are to be found within the OTAS Core platform.

Contact otassales@otastech.com for a login.