Category: Investing Insight

Investing insight to make you a better investor.

StockViz Tools

Compare and Plot multiple time-series datasets

Ever wondered how the dollar adjusted NIFTY MIDCAP 100 index performed vs. US Midcaps? Wonder no more! You can now quickly run a comparison using our new Compare tool.

compre time-series

We have made a large number of datasets available:

NASDAQOMX The NASDAQ OMX TR USD Dataset
MF A pruned set of Indian mutual funds
FRED The St. Louis FRED dataset
THEME StockViz Themes
IN_NSE Indices available on the NSE
IN_BSE Indices available on the BSE
ETF_US US listed ETFs
EQ_US US listed Stocks
EQ_NSE Stocks listed on the NSE
EQ_BSE Stocks listed on the BSE
MCX Commodity futures listed on MCX
NCDEX Commodity futures listed on NCDEX

The “THEME” comparison tools also gives you the impact of STT and brokerage costs on returns.

So, now you can compare pretty much anything with everything.

When it comes to plotting a single time-series, we have made intraday prices on stocks listed on the NSE available. You can run these 10-days at a time:
chart time-series

The daily chart of NSE stocks also marks important corporate actions:
TCS daily time-series candle-stick with corporate actions

Keeping it free

The biggest challenge we faced was managing data storage costs. Earlier, we tried to upload all the data to the cloud but we quickly ran into performance bottlenecks and costs overruns. So we went back to the drawing board and designed a hybrid solution where the data and the analytics reside within our firewalls and only results are displayed to the user. This allows us to keep these tools free and open to everybody.

I want more!

If you want to see something here that would be of interest to other investors/traders, please WhatsApp us (+918026650232) with your ideas!

Tax Drag on Compounding

The long-term capital gains tax on equity returns of 10% may not seem as much but it makes a huge difference if you are one of those “long-term” mutual fund investors who switch funds every year. To think through the effect of the tax on compounded returns, imagine a simple scenario where you invest in the midcap index and just sell and buy it back at the end of every year. In this hypothetical scenario, from the year 2002 through now, gross returns of buy-and-hold would have been 2245% vs. 1754% after tax. That’s ~22% of profits gone poof.

after tax midcap 100 returns

Will mutual fund investors be better behaved given this new normal?

Code and more charts on github.

Simple Momentum with Transaction costs and Taxes

The earlier post on a simple momentum strategy ignored transaction costs and taxes. Typically, these are added to backtests where gross profits are high enough to consider them for further analysis. However, one of readers requested that we add these costs to get an idea of their effect on returns.

To keep things simple, we assumed a 25bps net transaction cost and a 10% tax on gains. The tax part is a bit tricky so we ran the analysis with some simplifying assumptions. Follow the github link to the code if you are curious.

Running with these assumptions, transaction costs and taxes lopped 82% off gross returns over Jan 2005 through June 2018.

cumulative midcap 100 simple momentum strategy returns after transaction costs and taxes

What kills you are the taxes, not the transaction costs. There were only 17 trades throughout the period. It is the 10% tax on gains that ruins the compounding.

Code and other charts are on github. Look for ones with a ‘tx’ in the suffix.

Simple Momentum

Michael Batnick, in his blog titled “Simple Momentum,” proposes a strategy that follows a simple rule:

If the S&P 500 outperformed 5-year U.S. treasury notes over the previous twelve months, invest 100% of this portfolio in the S&P 500 in the following month. If the 5-year U.S. treasury notes outperformed the S&P 500 over the previous twelve months, invest 100% of this portfolio in bonds in the following month.

It outperformed the S&P 500 with significantly lower drawdowns. Could the same strategy work with Indian indices? We took NIFTY 50 and MIDCAP 100 indices and paired it with the 5-10 year tenure gilts.

Returns

The strategy returns are significantly lower than a simple buy and hold. December 2004 through June 2018, the NIFTY 50 version of it under performed buy and hold by 6% and the MIDCAP 100 version by 34%. This is before transaction costs and taxes. Here are the cumulative return charts:

NIFTY 50 simple momentum

MIDCAP 100 simple momentum

Drawdowns

The simple momentum strategy did have lower peak drawdowns than a buy and hold:

NIFTY 50 simple momentum drawdowns

MIDCAP 100 simple momentum drawdowns

What keeps you out of the troughs also ends up keeping you out of the peaks. This is highlighted by how the strategy behaved in 2008 and 2009:

NIFTY 50 simple momentum annual returns

Conclusion

The simple momentum strategy is perhaps too simple. The backtest doesn’t capture transaction costs and taxes that would further ding the already lagging gross returns.

You can peruse the code and the charts used in this blog on github.

Lumpsum vs. Dollar Cost Averaging (SIP)

Among Indian investors, SIPs (Systematic Investment Plans) are the rage right now. The total amount collected through SIP during May 2018 was ₹7,304 crore according to AMFI. SIPs are great for investors with a regular income – it matches the frequency of savings with the frequency of income. Structural discipline is always a welcome thing. However, for investors who have lumpy incomes or a windfall, it is often a dilemma whether to invest as a lumpsum or to setup an STP (Systematic Transfer Plan.)

Both SIPs and STPs are a form of DCA (Dollar Cost Averaging) where you average into an investment over a period of time (the accumulation phase.) The thing about DCA is that it ends up under-performing a lumpsum in markets that are trending up. Intuitively, you want to buy more when the price is low (in the beginning) and less when the price is high (at the end.) So, if the market is going up, then it makes no sense to spread a lumpsum over a period of time – you are guaranteed to make the later buys at a higher level, reducing your overall returns.

In the case of equity markets, the expectation is that they tend to go up over time. So if you are looking at a 10-20 year time horizon, then you are better off investing in one shot. To put this intuition to test, we modeled the returns of NIFTY, MIDCAP and GOLD as a Generalised Lambda Distribution (this works better than a normal distribution because these returns have significant skews and kurtosis) and ran a 10,000 path simulation to get a sense of the probability distribution of DCA vs lumpsum investments.

Roughly, this is like assuming that the weekly return distribution is going to be the same across 10,000 different worlds. So you pick set of random weekly returns from the same distribution 10,000 different times and see how DCA and lumpsum perform over those worlds. When you plot the density of those returns, you get an idea of how they compare.

To keep things simple, lets compare NIFTY MIDCAP 100 and GOLD. First, the price charts:

And now the simlulated cumulative return densities of MIDCAP and GOLD, modeled with data after 2010:

The area to the left of zero is that of negative returns. Lumpsums have a longer left tail compared to DCA so probability of a large negative outcome is higher for the former.
However, the total area under zero is higher for DCA in MIDCAPs so the probability of negative outcomes in general is higher for DCA/SIP.
Lumpsums have a fat right tail for both MIDCAPs and GOLD so the probability of large positive outcomes is higher for lumpsums.
“Average” DCA returns are less than “average” lumpsum returns but they occur with a higher probability.

For a prudent investor, it is the left tail that matters the most. Even though lumpsums hold out hope for higher returns (fat right tails,) they have a small probability of a big loss that is greater than that for DCA (longer left tails.) In conclusion, a prudent investor should convert a windfall into an STP and a risk-seeker should do a lumpsum.

For readers curious about the code and for additional charts with longer time periods, visit github.