In today’s blog post I take a data mining approach to find a potentially profitable trading strategy based on the movement of US treasury rates.
The idea of this strategy is to find a selection of stocks that respond favourably to a downward price movement in US Treasury yields.US Treasury yields are important cogs in the financial system so when Treasuries move they can have dramatic effects on a broad range of other assets.
The Process I Used
This is a simple system that shows a good out-of-sample performance and could be worth further investigation. It is not a fully complete strategy but outlines a unique approach.
The process I used for building this system is as follows:
- Create a simple system based on US Treasury yields
- Backtest the system to see which stocks perform the best
- Test the system on out-of-sample data to see if performance holds up for the same stocks
So, first of all we come up with some simple trading rules.
Then, we find the stocks that respond the best to those trading rules.
Next, we test the system on those stocks using out-of-sample data to verify our results.
Using the process above I began testing some simple rules using stock data from 1/2005 to 1/2015.
After a couple of iterations I ended up with the following basic trading strategy:
- US Ten Year Yield Closes < Bottom Bollinger Band (15,2)
- US Ten Year Yield Closes > 15-Day Moving Average
Amibroker Code Snippet
Yield10 = Foreign("%10YTCM","C");
Buy = Yield10 < BBandBot(Yield10,15,2);
Sell = Yield10 > MA(Yield10,15);
In other words, we go long a stock whenever the US ten year Treasury yield closes below the bottom Bollinger Band (two standard deviations below the 15-day MA) and we sell the stock when it closes back over the 15-day MA.
The rationale is that a big move in yields is often accompanied with some type of panic in the market. But ultimately, the long term outlook for an individual company is usually unchanged and therefore a profitable opportunity might exist in stocks during this moment.
Optimal Stock Selection
I then backtested the strategy rules on S&P 1500 stocks between 1/2005 to 1/2015 and sorted the results by net profit. I ended up with the following 20 stocks that the system performed best on:
I exported these stocks to a new watchlist ready for out-of-sample testing.
So now we have decided on our rules and we have found a selection of 20 stocks that our system performs really strongly on.
(A cursory glance indicates that many of the stocks are consumer stocks, healthcare stocks or financials. Maybe there is a logical reason for this but I’m not entirely sure.)
Nevertheless, we can now move forward and test this system on out-of-sample data on the same stocks and see if our strong performance holds up on new data.
So, testing this strategy on our selection of 20 stocks between 1/2000 to 6/2018 we recorded the following trade statistics and equity curve:
- Net Profit on $50K: 1067085
- CAR: 18.37%
- MDD: -24.22%
- CAR/MDD: 0.76
- # Trades: 1856
- Win Rate: 61.48%
- Avg. P/L %: 3.76%
- Profit Factor: 2.27
- Average Bars Held: 14.21
- Exposure: 25.84%
- Sharpe: 0.70
You can see that our system was profitable in both of our out-of-sample segments between 1/2000 – 1/2005 as well as 1/2015 – 6/2018.
We achieved a notably strong performance in 2000, 2003 and 2016 out-of-sample.
(Results include transaction costs of $0.005 per share and all trades are placed on the next market open following a trading signal using 5% position size).
We have come up with quite a simple but interesting trading strategy here that performs well on the out-of-sample data.
What I like about these results is that we have a couple of very strong years in the out-of-sample. I also like the average profit per trade which is 3.76% and the high win rate of over 60%.
Of course, the big concern with this strategy is whether or not our out-of-sample results are a fluke.
Using a data mining approach for stock selection guarantees optimal results in the in-sample but we cannot guarantee that the out-of-sample results are not by chance.
Furthermore, our out-of-sample results are clearly not as strong as our in-sample results. This is to be expected, however.
There are plenty of options for increasing our confidence in this system such as:
- Extending the length of the out-of-sample data
- Paper trading the system going forward
- Comparing our results to random results (Monte Carlo)
- Comparing our results to buy/hold or the underlying trend
For interest, the buy and hold return for the same 20 stocks between 1/2000 to 6/2018 is 15.7% with a Max drawdown of -80.6%. That’s a CAR/MDD of 0.19.
This strategy shows some potential but I’m not saying you should rush out and use it. As yet, we cannot guarantee that it will perform well in the future without more analysis.
But I wanted to write about this type of data mining technique because it is a method that you may not have thought about before.
Instead of the usual optimising of trading parameters we are optimising the actual universe of stocks that we want to trade.
Sometimes, it matters more to find the right market than to find the right rules.
This method does not always create winning strategies but I have used this technique with success in the past.
In fact, one of the ETF trading strategies on our Program was created with this approach and it has been performing very well since it was released two years ago with a high win rate of 76% and Sharpe of 2.86.
So next time you think about optimising your trading rules why not consider optimising your stock selection as well.
Simulation and charts in this article from Amibroker using data from Norgate Data.
Stocks were selected from the S&P 1500 universe. All trades executed on market open price.
Thank You For Reading
Joe Marwood is an independent trader and the founder of Decoding Markets. He worked as a professional futures trader and has a passion for investing and building mechanical trading strategies. If you are interested in more quantitative trading strategies, investing ideas and tutorials make sure to check out our program Marwood Research.
This post expresses the opinions of the writer and is for information or entertainment purposes only. It is not a recommendation or personalised investment advice. Joe Marwood is not a registered financial advisor or certified analyst. The reader agrees to assume all risk resulting from the application of any of the information provided. Past performance, historical or simulated results are not a reliable indicator of future returns and may not account for real world settings. Financial trading is full of risk and margin trading can lead to financial losses totalling more than what is in your investment account. We take care to present accurate analysis but mistakes in backtesting and presenting of analysis regularly occur. Please read the Full disclaimer.
Thank you to everyone who takes the time to leave a comment. Your feedback, constructive criticism and identification of mistakes is welcome. In order to concentrate on work I may not have time to respond to all comments.