Author: shyam

Weekly Recap: Investors’ DNA

nifty weekly performance heatmap

The Nifty put in a respectable +1.77% (+1.96% in USD terms.)

Index performance

Financials largely drove the rally, after spending weeks in the red…

weekly index performance

Top winners and losers

INDHOTEL +12.23%
ADANIPORTS +13.74%
ADANIENT +15.99%
RCOM -8.08%
NMDC -5.71%
BHARTIARTL -5.65%
Airtel got hit with $3B fine in some African country. And Adani continued to ENTertain…

ETFs

BANKBEES +3.36%
INFRABEES +3.17%
JUNIORBEES +3.12%
NIFTYBEES +1.61%
GOLDBEES +1.21%
PSUBNKBEES +0.57%
Is it just a relief rally or are we going to see the next leg-up?

Advancers and decliners

Not much hope here…

advance decline ratio

Investment Theme Performance

Momentum returned to the markets but pretty much all strategies won.

Sector Performance

The most battered sectors staged a comeback… Will this rally sustain?

weekly sector performance chart

Yield Curve

No big moves…

interest rate yield curve

Interbank lending rates

But the rate at which banks are lending to each other seems to be ticking up… Are stressed banks being forced to pay up?

mibor

Thought for the weekend

There is nature vs. nurture debate brewing when it comes it investing.

Seth Klarman, renowned value investor and president of the Boston-based Baupost Group, which manages $26 billion in hedge-fund assets, has this to say:

most people might possess “a dominant gene” for chasing hot performance and overhyped assets, while only a minority have “the recessive value gene” that confers a patient preference for whatever is battered and unpopular.

 
Many investors may in fact have a genetic predisposition to hunt for bargains in the stock market—although the environment you grew up in also powerfully shapes the kind of investor you become.
 
Source: The ABCs of Investors’ DNA

Developed Market Roundup

US back on top?

The latest Flash Manufacturing PMI numbers came in 56.7, its highest level for almost four years.

Markit US Feb Manufacturing PMI 2014

The Eurozone is recovering

The latest Flash Composite Output Index remains close to January’s 31-month high. New orders rose for a seventh successive month, and the rate of growth accelerated to reach the highest since June 2011.

Markit Eurozone Feb PMI 2014

Germany is raking it in

Flash Germany Composite Output Index is at a 32-month high, Services Activity Index is at a 3-month high.

Markit Germany Feb PMI 2014

However, its not all strawberries and cream…

France faces an uphill task

Although its Manufacturing Output Index, at 50.5, is at a 7-month high, Services Activity Index continued to fall and is presently at a 9-month low. New orders received by French private sector companies fell for a fifth consecutive month in February.

Markit France Feb PMI 2014

Big picture

Eurozone M3 money supply has been contracting since March. Germany is in wage deflation. And France’s core prices have been dropping for months, even if the core CPI index is still just positive at 0.1% on a year-to-year basis.

The gulf between periphery and core is as wide as ever:

periphery vs core

Further tightening of US monetary policy might very well tip the Eurozone over and force the ECB to embark on their own version of QE.

Interesting times…

Sources:

Calculate PEs for all Indices

index PE

Some investors like to use the PE ratio of an index to time their entry and exit. This is especially true about the widely tracked Nifty 50. However, there are advantages to rolling your own.

Annual vs. Quarterly EPS

The most popular approach of calculating PE is by dividing the price by the last reported annual EPS. This is probably fine most of the time. However, we prefer to add up the last 4 diluted quarterly EPS so that we have the latest numbers.

Closing vs. Live Prices

Once again, a matter of preference. Since most data points present the PE based on the last close, it may be useful to calculate it based on the live price, just to see the difference.

Other indices

Whereas the Nifty index PE can be obtained from a number sources, what about the other indices? And sector-wide PE estimates? By having a script handy, you can always have a ready reckoner of where things stand.

The Code

The StockViz API exposes the QuarterlyEps endpoint that returns the quarterly basic and diluted EPS in descending order of periods. You can use this to calculate the annualized number, grab the live price and adjust it by the stock’s weight within the index to arrive at the index EPS.

for cc in constituents:
	ticker = cc["SYMBOL"]
	#print ticker,

	price = common.getLivePrice(ticker)
	#print price,

	epss = common.getEps(ticker)

	annualEps = 0
	for i in range(0,4):
		annualEps += epss[i]["EPS_DILUTED_AEI"]

	#print annualEps, price/annualEps

	if annualEps != 0:
		indexPe += price/annualEps * cc["WEIGHTAGE"]

	indexPe /= 100

You can download the entire code on GitHub.

Previously

A Stochastic-MACD Model for Trading Nifty Stocks

Glenda Dowie has an interesting post up on investopedia:

Looking for two popular indicators that work well together resulted in this pairing of the stochastic oscillator and the moving average convergence divergence (MACD). This team works because the stochastic is comparing a stock’s closing price to its price range over a certain period of time, while the MACD is the formation of two moving averages diverging from and converging with each other. This dynamic combination is highly effective if used to its fullest potential.

To derive a buy signal out of these two indicators, first make sure that the MACD is trading over its signal line and then make sure that the %K crossed the %D in the last couple of days.

The problem with any multi-signal approach is that it requires you to track multiple stocks:

Because the stock generally takes a longer time to line up in the best buying position, the actual trading of the stock occurs less frequently, so you may need a larger basket of stocks to watch.

This is where you can use the StockViz API to make life simpler.

The StockViz Technical API for Equities (doc) gives you more that 50 technical stats to play with. The stochastic fields are “STOCH_FAST_D” and “STOCH_FAST_K” and the MACD fields are “MACD” and “MACD_SIGNAL.”

Here’s how it works.

Pseudocode

In order to scan all the Nifty 50 stocks:

  1. grab all the constituents of the index through the SymbolsOfIndex endpoint
  2. iterate through them and get the technicals
  3. check if the MACD is over the signal line. If it is, then check if the stochastic cross-over occurred over the last couple of days
  4. If both the conditions are met, then place the trade

Code

You can find the code on GitHub. We have extracted some shared code out into a “common” module. The main file reads much cleaner this way.

The code should be run at the beginning of the day and you can track the progress of this system through your StockViz account.

Stocks picked up today

stochastic-macd portfolio 20.02.2014

Note: You have to link your Mashape and StockViz accounts for the Accounts API to work (doc.)

Previously