Author: shyam

Weekly Recap: Growing Organically, Being Productive

Equities

world equity markets 2014-04-25.2014-05-02

The Nifty ended the week -1.30% (+0.16% in USD terms)

Major
DAX(DEU) +1.64%
CAC(FRA) +0.33%
UKX(GBR) +2.05%
NKY(JPN) +0.20%
SPX(USA) +1.04%
MINTs
JCI(IDN) -1.20%
INMEX(MEX) +2.12%
NGSEINDX(NGA) -0.84%
XU030(TUR) +5.98%
BRICS
IBOV(BRA) +3.00%
SHCOMP(CHN) -0.50%
NIFTY(IND) -1.30%
INDEXCF(RUS) +1.93%
TOP40(ZAF) +0.37%

Commodities

Energy
Brent Crude Oil -1.12%
Ethanol -6.11%
Heating Oil -2.28%
Natural Gas +1.04%
RBOB Gasoline -4.28%
WTI Crude Oil -0.68%
Metals
Copper -1.60%
Gold 100oz -0.22%
Palladium +0.20%
Platinum +1.14%
Silver 5000oz -2.02%

Currencies

USDEUR:-0.25% USDJPY:+0.05%

MINTs
USDIDR(IDN) -0.35%
USDMXN(MEX) -0.92%
USDNGN(NGA) -0.65%
USDTRY(TUR) -1.34%
BRICS
USDBRL(BRA) -0.99%
USDCNY(CHN) +0.11%
USDINR(IND) -0.76%
USDRUB(RUS) -0.56%
USDZAR(ZAF) -1.69%
Agricultural
Cattle -4.47%
Cocoa -1.53%
Coffee (Arabica) -0.59%
Coffee (Robusta) +1.08%
Corn -2.66%
Cotton +0.95%
Feeder Cattle +2.11%
Lean Hogs -3.17%
Lumber +2.80%
Orange Juice -4.19%
Soybean Meal +0.20%
Soybeans -1.12%
Sugar #11 +1.40%
Wheat +1.03%
White Sugar -1.42%

Nifty Heatmap

CNX NIFTY heatmap 2014-04-25.2014-05-02

Index Returns

index performance 2014-04-25.2014-05-02

Top winners and losers

HINDPETRO +4.55%
GLENMARK +10.30%
UPL +21.53%
JINDALSTEL -13.11%
DLF -8.98%
TATASTEEL -8.63%
DLF’s Vadra moment?

ETFs

PSUBNKBEES -0.18%
BANKBEES -1.36%
JUNIORBEES -1.55%
NIFTYBEES -1.77%
INFRABEES -5.94%
No ETF left behind in the green zone!

Investment Theme Performance

Value worked, momentum worked. Smart-beta? Not so smart. Also, this might be the last month that Velocity would be available. It has been superseded by Momentum 200. While Velocity looked at prices to gauge momentum, the new algorithm uses a probabilistic setup.

Sector Performance

sector performance.2014-04-25.2014-05-02

Yield Curve

yield Curve 2014-04-25.2014-05-02

Thought for the weekend

Organically, value grows bit-by-bit, but often prices move in a more volatile fashion. Try to win by buying stocks that grow value. Winning from speculation is a crapshoot. Avoid it, the odds are against you.

Imagine for a moment that we did not have financial markets. Who would do the best? Those that compounded their economic activities the best — those who were the most productive. The same is true for us today. Focus on companies that are productive, growing organically. That is almost always a good road to profits.

Source: Avoid Easy Money

Monthly Recap: Of Pairs and Options

world equity markets 2014-03-31.2014-04-30

Euphoria? What euphoria? The NIFTY ended the month -0.12% (-0.51% in USD terms)

Equities

Major
DAX(DEU) +0.50%
CAC(FRA) +2.18%
UKX(GBR) +3.19%
NKY(JPN) -2.73%
SPX(USA) +0.62%
MINTs
JCI(IDN) +1.75%
INMEX(MEX) +0.96%
NGSEINDX(NGA) -0.68%
XU030(TUR) +5.80%
BRICS
IBOV(BRA) +2.85%
SHCOMP(CHN) -0.34%
NIFTY(IND) +0.36%
INDEXCF(RUS) -4.62%
TOP40(ZAF) +1.88%

Commodities

Energy
Brent Crude Oil +0.03%
Ethanol -37.72%
Heating Oil -0.68%
Natural Gas +8.10%
RBOB Gasoline +0.87%
WTI Crude Oil -2.04%
Metals
Copper -0.66%
Gold 100oz +0.01%
Palladium +4.84%
Platinum +0.49%
Silver 5000oz -4.04%

Currencies

USDEUR:-0.61% USDJPY:-0.78%

MINTs
USDIDR(IDN) +1.55%
USDMXN(MEX) -0.08%
USDNGN(NGA) -2.97%
USDTRY(TUR) -1.56%
BRICS
USDBRL(BRA) -1.47%
USDCNY(CHN) +0.68%
USDINR(IND) +0.45%
USDRUB(RUS) +1.33%
USDZAR(ZAF) -0.28%
Agricultural
Cattle -4.56%
Cocoa -3.26%
Coffee (Arabica) +14.59%
Coffee (Robusta) +0.51%
Corn -0.05%
Cotton +1.23%
Feeder Cattle +3.64%
Lean Hogs -6.97%
Lumber +0.92%
Orange Juice -1.23%
Soybean Meal +1.17%
Soybeans +0.44%
Sugar #11 -2.98%
Wheat +0.04%
White Sugar +0.89%

Nifty Heatmap

CNX NIFTY.2014-03-31.2014-04-30

Index Performance

index performance 2014-03-31.2014-04-30

Top winners and losers

ADANIENT +13.55%
RANBAXY +29.75%
UPL +45.35%
DLF -20.57%
JINDALSTEL -12.72%
SIEMENS -10.12%
Adani’s contribution to Modi’s campaign did not go unnoticed in the markets… DLF got dragged into all the mud-slinging between the BJP and Priyanka Gandhi’s husband.

ETFs

PSUBNKBEES +10.14%
GOLDBEES +2.90%
BANKBEES +2.79%
JUNIORBEES +2.20%
NIFTYBEES +0.42%
INFRABEES -6.70%
PSU Banks rallied, Infra took a breather.

Advancers and Decliners

advancers and decliners 2014-03-31.2014-04-30

Investment Theme Performance

This might be the last month that Velocity would be available. It has been superseded by Momentum 200. While Velocity looked at prices to gauge momentum, the new algorithm uses a probabilistic setup.

Sector Performance

sector performance 2014-03-31.2014-04-30

Yield Curve

yield Curve 2014-04-02.2014-04-30

Interbank Lending

mibor.30days.2014-04-30

This month

We introduced core trading concepts surrounding options and pair trading.

Read:
Options Trading Guide
Pair Trading Guide

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.

The Bank Nifty – ICICI Bank Pair

We defined the spread between a pair to be:

spread = A – βB

where A and B are prices and β is the first regression coefficient.

The β is also known as the hedge ratio.

Neither β, nor the relationship is “guaranteed” to be stable. Here are the p-values and β of Bank Nifty vs. ICICI Bank nearest to expiry futures, with a 50-day look-back:

BANKNIFTY - ICICIBANK p-value and beta 50

As you can see, the spread has periods of stability and adjustment. And sometimes, the stability is the anomaly.

To be continued…

Finding Pairs to Trade

Correlation

When we discussed banks and introduced pair trading, we pointed out that 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?

Traders new to pair trading often mistake the correlation of prices to be indicative of “similarity”. For example, consider the Bank Nifty, HDFC Bank and ICICI bank. Here’s the chart of the closing price of the nearest to expiration futures contract:

bank-futures-prices

And there are some really tight correlations:

BANKNIFTY HDFCBANK ICICIBANK
BANKNIFTY 1.0000000 0.7419966 0.9462238
HDFCBANK 0.7419966 1.0000000 0.8327847
ICICIBANK 0.9462238 0.8327847 1.0000000

However, this is only part of the story. What we need are pairs who’s price movements are mean reverting. Looking at price correlation alone is not enough.

Spreads

We need the spread between pairs to be “stable”, i.e., mean reverting.

spread = A – βB

where A and B are prices and β is the first regression coefficient.

200-day spreads

Here are the spreads between these pairs using 200-day data for regression:

BANKNIFTY - ICICIBANK Spread 200

BANKNIFTY - HDFCBANK Spread 200

ICICIBANK - HDFCBANK Spread 200

50-day spreads

Here are the spreads between these pairs using 50-day data for regression:

BANKNIFTY - ICICIBANK Spread 50

BANKNIFTY - HDFCBANK Spread 50

ICICIBANK - HDFCBANK Spread 50

Testing for cointegration

You don’t have to visually inspect spreads to see if they are mean-reverting. The most straightforward way of checking if a time-series is co-integrated is to perform a Dickey-Fuller test on it. If the p-value is less than 0.10, then this could be a good pair for trading.

N Pair p-value
300 BANKNIFTY vs. ICICIBANK 0.010000
300 BANKNIFTY vs. HDFCBANK 0.904480
300 ICICIBANK vs. HDFCBANK 0.407347
200 BANKNIFTY vs. ICICIBANK 0.010000
200 BANKNIFTY vs. HDFCBANK 0.472129
200 ICICIBANK vs. HDFCBANK 0.037115
100 BANKNIFTY vs. ICICIBANK 0.223806
100 BANKNIFTY vs. HDFCBANK 0.980776
100 ICICIBANK vs. HDFCBANK 0.670717
50 BANKNIFTY vs. ICICIBANK 0.429057
50 BANKNIFTY vs. HDFCBANK 0.405498
50 ICICIBANK vs. HDFCBANK 0.133357
30 BANKNIFTY vs. ICICIBANK 0.570427
30 BANKNIFTY vs. HDFCBANK 0.057717
30 ICICIBANK vs. HDFCBANK 0.370011

If you are trading futures, then a 200-day fit may not make much sense. The latest 30-day test between BANKNIFTY and HDFCBANK has a surprisingly low p-value of 0.057, indicating that there is a potential trade there.

To be continued…