Author: shyam

SVM for Momentum

Previously, we explored if Meta’s Prophet library could be used to drive a momentum portfolio (Prophet for Momentum, Prophet for Momentum, Part II). We found that a simple (naïve) momentum strategy outperformed whatever we did with Prophet.

More generally, using a Neural Network or an SVM to drive portfolios have been a disappointment in live scenarios (Machine Learning Themes). Their after cost performance trail benchmarks.

Moreover, a big problem with these models is that there are a million different ways to specify them and a few of them will go on to outperform in a forward-test simply because they load on a factor that is working for that moment in time. So, you never know if you found the “right” set of specs (because there is none) and if you are not careful, you will forever be tuning the model based on what worked in the recent past.

Even simple SVMs come with so many different ways to specify them: classification vs. regression, polynomial degree, cost (static vs. auto-tune), feature selection, feature tuning, etc. And, since we don’t know which ones work beforehand, we try most of them and settle on those specs that output the results we wanted.

For example, an SVM can be trained with a time-series of previous month’s returns to predict the next month’s returns. A momentum portfolio can be created by ranking these predictions. Rebalance every month and you have something that works.

The problem is that to arrive at this model, we went through a fair amount of parameter and feature tweaking/tuning which may or may not work in the future.

Here, we published the charts of an SVM that uses a 5th degree polynomial kernel because it worked (higher Sharpe!) and not because there is a strong theoretical reason why 5 is better than 1.

For every model that is published, be rest assured that there are thousands hidden away in a drawer.

This is why we remain skeptical of “A.I.” investment strategies.

Code and charts on github.

Standard breakout strategy

The book Following the Trend: Diversified Managed Futures Trading, Andreas Clenow, describes a simple “breakout” strategy:

If today’s close is higher or equal to the highest close in the past 50 days, we buy tomorrow; if the close is below or equal to the lowest close for the past 50 days, we sell open tomorrow and go short. A similar logic is used to get out of positions, where a long trade is sold when the close reaches the lowest point in 25 days and a short trade is covered when the price makes a 25-day high.

The book was published more than a decade ago and traders would’ve moved on from the basic strategy it described. However, we were curious if it ever worked at all on Indian indices. So, we ran a backtest.

Turns out, it never did.

Layering a trend filter seems to help a little.

While the strategy avoids some really steep drawdowns, the backtest doesn’t consider trading costs, taxes, etc.

While you could data-mine and get to a bunch of parameters that might work for “trading breakouts”, there is no reason why it should continue to work in the future.

Code and charts for other indices are on github.

Intraday Momentum, an Update

Back in 2016, we ran a sniff test on Intraday Momentum: The First Half-Hour Return Predicts the Last Half-Hour Return (pdf). We promised an update so here it is (eight years later).

We ran the strategy with both the first 15min and 30min formations with and without considering gaps. It continues to not work with the three indices we used: NIFTY, BANK NIFTY and MID SELECT. Here’s the one for the NIFTY. The rest are on github.

Some strategies may benefit from becoming well known. However, a vast majority of them don’t. This one belongs to the former.

Prophet for VIX

Open sourced by Meta back in 2017, Prophet is a procedure for forecasting time series data. How does it compare to GARCH(1,1) and locf (last one carried forward) for forecasting VIX 20 days out?

We fit 500-days of rolling VIX data using Prophet and GARCH(1,1) and forecast forward 20-days. We then calculate the RMSE (Root Mean Squared Error) of the forecast vs. actual of both the models and locf. Plot RMSE of all three.

Ideally, you want the error to be low and the tail of errors to be as short as possible. GARCH(1,1) looks worse than Prophet. However, locf beat both?

When in doubt, take the average.

Code on github.

Also: VIX Seasonality

Prophet for Momentum, Part II

Previously, we discussed using Meta’s Prophet to create a momentum portfolio that was rebalanced monthly. Is there a benefit to rebalancing this at a higher frequency?

Turns out that there isn’t. Even before factoring in costs, Prophet works best with a monthly schedule.

And does significantly worse if bring costs into the equation.

The problem is that Prophet portfolios have little overlap.

Once again, a +1 to KISS.

Code and charts on github.