Improving your system by learning from wins and losses

System Trading

Jan 19

In Murray A. Ruggiero’s “Cybernetic Trading Strategies”, a book that I think was ahead of its time, Ruggiero shared the concept for “nearest neighbor matching” for statistical pattern recognition. The concept was shared in the context of looking for market patterns and market analogs.

However, I wanted to share a slight variation on this concept. Instead of looking for patterns in the market that have an edge, the idea is rather to track secondary market characteristics for your systems winning and losing trades, and to learn from that information which trades are more or less likely to be a winner or loser. The idea is to use a supervised learning process for improving system quality by tracking the systems winning and losing trades.

For your feature set, you calculate a distance measure (or a similarity score) for recent winning and losing trades. When your system signals a trade then you compare the current conditions to the historical conditions and if the conditions are closer to losing trades then winning trades then you skip the trade. You could build on this logic, of course. For example, you could position size based on your confidence the trade would be a winning or losing trade.

The best part of this method is that it can be adaptive and additive  to the existing system logic. Because the method is adaptive, it doesn’t depend on finding stable or easily discovered patterns.

There is a catch, though. Because this system is learning from its own wins and losses: the actual learning process will change the system results. This could have various ramifications. The system might stop trading and enter a sub-optimal state where it isn’t able to learn from new signals.

A simple solution that I used was to ignore the self-learning rules if too many days had passed since the last trade. Another solution would be to use the self-learning logic for position sizing only and to normalize the wins and losses for the self-learning engine. Another more advance solution would require tracking virtual position profits.

The results below show how this method improved an EMINI S&P 500 futures system built on principles shared in previous posts.

This was a first application without extensive feature engineering which should lead to better results. Even so, we were able to produce approximately $3,000 more profit taking 30 fewer trades. We were able to boost the profit factor, average profit per trade, and the system’s win ratio.

In the equity curves below, it is notable that the recent system breakdown was avoided. However, I also like to look at how the systems perform over time and on a rolling basis. A system that outperforms most years gives me greater confidence. While not easy to see in the graphs below, on a rolling equity basis the new system has tended to outperform the most recent several years.

I decided to test the technique against a simpler RSI(2) system variation. The version without the ML adaptation completely broke down during the recent market turmoil while the ML model appears within norms.

Liked this article? I will be offering the Easylanguage source code for this system and more in the near future. If you want to be first to know when it is ready then please shoot me an email.

About the Author

The author is passionate about markets. He has developed top ranked futures strategies. His core focus is (1) applying machine learning and developing systematic strategies, and (2) solving the toughest problems of discretionary trading by applying quantitative tools, machine learning, and performance discipline. You can contact the author at curtis@beyondbacktesting.com.

>