Tag: quant

The Omega Ratio

We are all aware of the Sharpe Ratio – the ratio between excess return and risk. Mathematically, it is (average return - benchmark return)/standard deviation of excess returns. The main drawback of the Sharpe Ratio is that market returns have fat tails, skews and kurtosis. Numerous performance ratios have been proposed to take care of these “higher moments.” One of them is the Omega Ratio.

The math is a bit hairy. I encourage inquisitive readers to go through Quantdare’s post on this topic. It also has a link to the original paper.

However, using R to calculate Omega is straightforward enough. Here is how a plot of rolling 5-year Omega of the S&P 500 and NIFTY 50 Dollar indices looks like:
Omega of S&P 500 and NIFTY 50 USD

Is it really a step up from the original Sharpe Ratio?

Sharpe Ratio of S&P 500 and NIFTY 50 USD

Code and charts are on github.

Streaks, Part II – Backtest

In Part I of this series, we saw that it is very rare for two consecutive down months to be followed by a third one. Here, we present a simple backtest that goes long NIFTY 50 for a month if the previous two months were negative.

backtest cumulative returns

The shallow drawdowns of this strategy makes it ideal for leveraged trades. NIFTY futures are about 7x levered. That should transform the 190% gross return to about 1330%, beating buy and hold by a wide margin. The MIDCAP 100 index behaves similar to this between the 2005 through 2018 time-frame. However, the results are not so great if you include data prior to 2005.

This looks like a case of severe data-mining and should be discounted as such. But it is an interesting result nevertheless.

Code and charts are on github.

Streaks, Part I

A streak of returns is an unbroken set of up or down days, weeks or months. For example, if the market went up on each of the last four days, then it is a streak of 4 daily returns. Can streaks predict the direction of subsequent returns? Before we answer that, let us look at the density plots of up and down streaks over different periods of time. In the charts below, green lines represent positive returns and red represent the negative ones.

Distribution of NIFTY 50 daily return streaks:

Distribution of NIFTY 50 weekly return streaks:

Distribution of NIFTY 50 monthly return streaks:

Looks like something could be done with monthly returns. Click through to Part II for a quick backtest!

Code and images are on github.

S&P 500 SMA Regimes

In the post Mixture model over S&P 500 returns, we looked at how mixture models can be used to classify returns as belonging to “bull” or “bear” regimes. Unfortunately, we found that using it to trade the index itself was a losing proposition. This lead us to ask ourselves whether a mixture model was any better than a simple moving average based classifier.

Daily returns

If we split returns that occur over different moving averages (50-, 100-, 200-days) and plot their densities, we can see how losses are more frequent when the index is trading below some moving average:
S&P 500 simple moving average returns density plot

Avoiding being long the index when it is trading below a moving average seems to be a good idea. And a quick back-test shows the 200-day average is the one to watch:
S&P 500 long-only SMA returns

All the moving-average “systems” above out-performed the mixture-model based system.

Take-away

Simple beats complex, most of the time.

Code and charts are on github.

Mixture model over S&P 500 returns

Market returns have different characteristics depending on whether they are in a “bull” phase or a “bear” phase. Daily returns can be labeled as either belonging to the “bull” camp or the “bear” camp using mixture models. This post extends Eran Raviv’s idea described here.

Rolling vs. whole period analysis

The density plot of daily returns of the distributions fit by the mixture model using the entire data-set of daily returns looked promising. There was a very visible difference in the way returns behaved under the two regimes. However, rolling period analysis hews closer to the real world. And the densities don’t look as pretty:
density plot of returns in stable and unstable regimes

Sure, “unstable” or “bear” regimes have slightly fatter tails but the densities are not as different as they appeared to be in the whole-period analysis.

Another gotcha is that when the regimes are superimposed on the S&P 500 price index, it looks like it could be good idea to use this system to trade it:
S&P 500 regimes
1 (blue) => stable

Timing signal?

It looks like the model helped escape most of the 2008 carnage and the “stable” regime looks to be long most of the up-trends. However, the overall return profile is sub-par when used in a systematic trading strategy:
S&P 500 cumulative returns

Take-away

Mixture models are an interesting tool in the quant tool-box. However, like how using skew as a timing signal appeared to be a good idea on the face of it, it turns out that using mixture models to time trades in a linear fashion is not such a good idea.

Code and charts on github.