Tag: quant

The SMA Risk On/Off Switch

Market timing is a very divisive topic in investing. For traders, it has been the search for the holy grail. For passive investors, a source of derision.

Far more money has been lost by investors preparing for corrections, or trying to anticipate corrections, than has been lost in corrections themselves. – Peter Lynch

Does it mean investors should just remain long all the time? Hardly, according to the latest research by Meb Faber (ssrn).

Data for international markets show that volatility increases in declining markets. Any strategy that keeps you out of those periods, will improve your portfolio returns. The outline of his strategy is simple: go long the market if it is trading more than its 200-day SMA and stay out of the market otherwise.

A small amount of outliers have a massive impact on performance and the best and worst outliers tend to cluster when the market is already declining. However, if you miss the best and worst days in every case your compound return is higher than buy and hold.

It works across most international markets:

miss best and worst days

Unfortunately, the paper doesn’t discuss the Indian markets, so lets try and fix that.

Best and worst days

The table below shows that in a rising market, +1% days (BEST) outnumber -1% days (WORST) and the reverse is true of declining markets. Also, as you decrease the look-back period, the WORST to BEST ratio increases in a declining market.

nifty best worst

Cumulative Returns

If you apply the SMA switch to the Nifty index, here’s how the cumulative returns look like:

nifty cumulative returns

200-day SMA Cumulative Return Chart

Since: 2000
CNX NIFTY-200-day-sma-returns-2000

Since: 2010
CNX NIFTY-200-day-sma-returns-2010

50-day SMA Cumulative Return Chart

Since: 2000
CNX NIFTY-50-day-sma-returns-2000

Since: 2010
CNX NIFTY-50-day-sma-returns-2010

Drawdowns

If the SMA rule really helped investors stay out of negative fat tails, then it should manifest itself in the drawdowns.

drawdowns

Conclusion

Using a simple SMA rule helps investors avoid drawdowns and boost returns as compared to a naive buy and hold strategy. The smaller the look-back period, the better the returns and lower the drawdowns.

Market Cap Deciles

Introduction

Segmenting the market to track performance, risk etc. has been around for a long time. The Dow Jones Industrial Average was launched in 1896, the Sensex since 1986 and the Nifty since 1995. They provide a short-hand to gauge market performance and track returns over a period of time.

Index construction

An index can be constructed based on any combination of factors that are common to its constituents. They can be sectoral like FMCG, IT, etc. or they can be based on fundamental factors like book value, sales, etc. However, the most common way to construct an index remains free float market capitalization. This is the approach that most indices, like the Nifty, take.

The Nifty lists the following criteria for its constituents (NSE):

  1. Liquidity (Impact Cost)
  2. Float-Adjusted Market Capitalization
  3. Float
  4. Domicile
  5. Eligible Securities
  6. Other Variables

Deciles vs. Indices

Using existing indices come with some disadvantages:

  1. Rebalancing usually occurs once every 6 months – a lot can happen in that time.
  2. They usually have “other” considerations – not entirely quantitative.
  3. Do not cover the entire market – the biggest index in the NSE is CNX 500 that track 500 stocks.

An alternative is to build your own set of indices based on purely quantitative considerations. For example, you could divide the market into deciles based on their free float market cap and set a minimum daily turnover. This will then allow you to track micro-cap through mega-cap performance over arbitrary time frames, track how different stocks transition through deciles, set up “early warning” signals, etc.

Example

If you divide the market into deciles and set the minimum daily turnover to be 0.01% of float, then you end up with about 140 stocks in each. The 1st decile would be the micro-caps while the 10th would be the mega-caps. Here’s how the different deciles performed this week:

decile

Watch out for decile performance charts in our weekly and monthly performance roundups!

Backtesting a Pair Trading Strategy

A pairs trading strategy involves answering these questions:

  1. How do you identify “stocks that move together?”
  2. Should they be in the same industry?
  3. How far should they have to diverge before you enter the trade?
  4. When is a position unwound?

We saw how to answer the first two questions: understanding, defining, finding, and investigating pairs.

Trading strategy

We can start with a simple trading strategy: we buy the spread if it is one standard deviation below the average and sell the spread if its is one standard deviation above the average.

To keep things simple, we’ll ignore execution details like lot-size, actual $ p&l, etc… and focus on the viability of the strategy. We calculate p&l in terms of unit-spread, i.e., how many ‘spreads’ of p&l did the strategy create?

For BANKNIFTY vs. ICICIBANK, we simulated the strategy outlined above based on the daily close of the nearest to expiry futures from Jan-2010:

BANKNIFTY - ICICIBANK pair trade backtest 50 2010-01-01 long-short

The top chart is the the spread.
The 2nd is the trade: green implies the strategy went long the spread, red implies short.
The 3rd chart indicates the p&l of that specific trade (in spreads).
The last chart indicates the cumulative p&l (in spreads).
 
The p&l for this strategy over the entire time-period is +69.3189 spreads.

Asymmetric strategy

The idea behind the above strategy is to bet on mean-reversion on both sides. However, if you see closely, the shorts were not nearly as profitable as the longs. You could be better off just going long the spread whenever it hit one standard deviation and staying out of the market when the spread hit the upper band.

BANKNIFTY vs. ICICIBANK, long-only p&l +454.3036:

BANKNIFTY - ICICIBANK pair trade backtest 50 2010-01-01 long only

BANKNIFTY vs. HDFCBANK, long-only p&l +231.5225:

BANKNIFTY - HDFCBANK pair trade backtest 50 2010-01-01 long only

Conclusion

Some caveats:

  1. The signals are intermittent, but you need to keep running the algorithms everyday to capture the alpha. This requires an investment in systems on your part.
  2. The backtest ignores execution risk. For example, the hedge ratio is around 0.09830581 and there’s no way you can trade 1/10th of a contract. So your actual executable spread = 10 ICICIBANK – BANKNIFTY. That’s 11 contacts and it still doesn’t give you precision.

On the plus side:

  1. The backtest doesn’t do any risk management. This would’ve stop-loss’ed most of the bad trades.
  2. There is money to be made on the right pairs.