clockbox-plotdata-warehousebookdecision-tree
 

Back to all projects

Optimal Trading Rules Detection Research

Introduction

Most of our clients are investment managers trading various market instruments such as stocks, futures, options, cryptos and ETFs. Some of them rely on quantitative, systematic techniques, others use fundamental analysis and discretionary investment style. Regardless of investment style asset manager faces the problem of optimal trading rules detection. When a trader takes either long or short position in market instrument usually fix profit/stop-loss level and maximum holding time need to be determined. Intraday traders use advanced trading rules such as trailing fix profit, or SMA crossover to determine the time when a position should be liquidated with either profit or loss. However, almost every trading rule has parameters which need to be either defined in advance or optimized. For example, in trailing fix profit/loss system we need to define % of initial price set as trailing threshold, SMA crossover has 2 parameters: slow SMA window and fast SMA window used to detect crossover.

Project overview

Recently, our client faced the problem described above. Client's research team has developed a trend-following investment strategy which trades various index ETFs. The strategy perfectly detects trade entry points and direction, however, out-of-sample risk-adjusted performance was much lower comparing to backtested results. Tradelog analysis has shown that profits from true predictions were much lower compared to losses from false predictions on out-of-sample period. As a result, the client asked us to help him understand the source for poor performance and how it can be resolved.

Trading rules overfit

After the first meeting with the client's research team, we have understood that strategy's trading rules very overfit. The client simply used standard grid-search approach and picked a combination which yields the highest Sharpe ratio on backtested period. As a result, trading rules were overfitted and didn't work out-of-sample. Instead of optimizing trading rules on one asset scenario, we've suggested to generate synthetic asset paths and pick trading rule which shows the highest average risk-adjusted performance on all simulations instead of one observed path. The approach is used to tackle the problem of overfitting: overfitting 10000 market scenarios is much more difficult comparing to overfitting single observed path.

Generating synthetic paths

Financial time series show a high level of autocorrelation and heteroscedasticity. The bootstrap technique is efficient under the assumption that observations are independent which is not true for financial time series. That is why instead of the standard bootstrap technique we used our proprietary machine-learning algorithm to generate various simulations of traded assets.

text

Trading rules universe

Our team constructed the universe of possible trading rules including already known trailing fix profit/loss, SMA crossover, RSI exit, etc. The client's strategy trades intraday that is why all simulations take into the account trading costs and execution slippage to get the most accurate estimate of profit and loss.

Optimization framework

Naive grid-search of all possible parameter combinations for each trading rule could take weeks even on advanced IT infrastructure. Instead of that, we used Bayes optimization algorithm to find the top-performing parameter-rule combination.

text

Research results

New set of trading rules slightly decreased Sharpe ratio on in-sample period from 2.17 to 1.92, on the other hand, out-of-sample performance increased from 1.27 to 2.05

Back to all projects