We combined books and research papers to create a knowledge base. We then used that to create a research program to check if they can be applied to Indian stocks/futures for profit. Our threshold for success was outperformance against naive momentum/trend strategies. RL implementations tend to be complicated and compute intensive. They least they can do is beat simple systems. Also, India is an expensive venue to trade so these tests included those costs as well.
Across every reward, cost, state, action, algorithm, universe, and venue we tried, no RL agent beat classical baselines net of costs out-of-sample.
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.
Please read Part I and Part II for an introduction. Part III extends the treatment to other dollar indices. Part IV looked at an ensemble model from our learnings from Part III.
In this final part of our series on training a simple Support Vector Machine on currency indices to predict the NIFTY, we will incorporate a Simple Moving Average into our decision matrix. While our model in Part IV would go long/long-short based purely on the predictions of the SVM, the model we use here will go long only if both the prediction is positive and the NIFTY is above a 50-day SMA and go short only if both the prediction is negative and the NIFTY is below its 50-day SMA. Think of the SMA as a regime signifier.
Results
Cumulative returns:
BH: buy & hold
L0: Long-only using SMA 50 alone
LS0: Long-short using SMA 50 alone
L1: Long-only using DTWEXB SVM and SMA 50
LS1: Long-short using DTWEXB SVM SMA 50
L2: Long-only using DTWEXM SVM and SMA 50
LS2: Long-short using DTWEXM SVM SMA 50
L: Long-only using ensemble SVM and SMA 50
LS: Long-short using ensemble SVM SMA 50
The SVM that is only based on DTWEXM (LS2) give better returns than the one based on the ensemble model (LS.) However, the ensemble model had a slightly lower drawdown of the two. Also, when compared to the earlier version that did not use the SMA, LS2 under-performs by about 10%. However, the key difference is in the drawdowns. Using the SMA filter reduced drawdowns significantly, especially the one occurring in 2018.
Without SMA filter:
With SMA filter:
Conclusion
An SVM with a 4th degree polynomial over the DTWEXM currency index in conjunction with a 50-day SMA seems to be the winning combination.
Please read Part I and Part II for an introduction. Part III extends the treatment to other dollar indices.
In this part of our ongoing series on using SVMs on dollar indices to predict the NIFTY 50, we create an ensemble of two models. We combine one on DTWEXB, using an 8th degree polynomial kernel and another on DTWEXM, using a 4th degree polynomial kernel, to create long-only and long-short portfolios.
Results
Here are the cumulative returns of the standalone models and the ensemble:
The standalone model over DTWEXM (LS2) seems to outperform all other models, including buy and hold. However, the ensemble model (LS) has lower drawdowns and comes in at second place. Here are the list of drawdowns deeper than 5% over the test dataset:
Buy and hold drawdowns
Ensemble drawdowns
In the next (and final) post, we will explore if we can add a simple technical signal into to mix to boost returns and reduce drawdowns.
In Parts I and II, we saw how a polynomial kernel was probably a good way to tune an SVM. Also, there was no single degree parameter that was necessarily better than the others. In this post, we train three different polynomial kernel SVMs on two other dollar indices (DTWEXB and DTWEXO) and USDINR (DEXINUS) and tabulate their returns over the two different datasets and across different degree parameters.
To recap, The FRED publishes the following indices along with USDINR (DEXINUS):
DTWEXB: Trade Weighted U.S. Dollar Index: Broad
DTWEXM: Trade Weighted U.S. Dollar Index: Major Currencies
DTWEXO: Trade Weighted U.S. Dollar Index: Other Important Trading Partners
We modeled DTWEXM in Parts I and II. Here, we model the rest.
Results
2000-2018
2005-2018
Given the results above, we can ignore DTWEXO going forward. Surprisingly, DEXINUS (USDINR) does not predict the 2018 correction. In fact, the DEXINUS model using the 2005-2018 dataset replicates buy&hold. Hence, we will ignore DEXINUS as well. The SVM modeled on the 2005-2008 dataset using DTWEXB with degrees 5, 6 and 8 seem to have side-stepped the 2016 and 2018 corrections. Furthermore, degree 8 seems to have produced the best cumulative returns on the test set.
Next steps
Our observation from Part II was that a 2005-2018 dataset is probably a better set than 2000-2018. This is confirmed from the DTWEXB model above. In the next post, we will combine the DTWEXB(8) and DTWEXM(4) SVM models using the 2005-2018 datasets.