There was an article recently in a popular website discussing an ETF rotation strategy in weekly timeframe with excellent performance statistics. In this article we show how to develop strategies for trading ETFs that do not suffer from data snooping issues and related biases.
The potential problem with the strategy mentioned is that the two ETFs, and specifically their ratio that was used in a formula to decide how to switch a long position from one to the other, were selected after testing about 700 such pairs, according to the author. Obviously, when someone tests many combinations of assets to select the best performing combination there is risk of getting fooled by randomness by, known with this fancy term, data-mining bias.
How do you test for the presence of data-mining bias especially when out-of-sample testing does not make any sense or is inappropriate due to data-snooping?
Academics suggest adjusting the performance parameters, such as the Sharpe ratio, by some suitable number derived from the number of trials performed before selecting the best strategy.
This is never done in trading literature by practitioners and it may not even make sense because, among other things, it will rule out 99.99% of suggested strategies.
In this article we take another route: we let DLPAL S develop strategies in an in-sample and then combine them for both ETFs. Afterwards, we test the combined strategy in out-of-sample.
Our objective is a strategy with better risk-adjusted returns since it is nearly impossible to beat a central bank-driven market on an absolute returns basis.
DLPAL S setup
We use daily data for IJR and IEF from inception to 12/31/2009 for the in-sample and with standard workspace parameters. For IJR we use 3% profit target and stop-loss and for IEF 1.5%, as determined by Price Series Statistics tool of the program. The workspace for in sample price action anomaly detection is shown below:
There are separate search lines for each ETF in this workspace. Alternatively, one could set up separate workspace for each ETF.
In-sample results
Below are the in-sample results for each ETF after removing short strategies since we are only interested in a long-only ETF strategy.
IJR
DLPAL S found 87 long strategies for IJR that fulfilled the performance criteria defined on the workspace.
IEF
DLPAL S found 259 long strategies for IEF that fulfilled the performance criteria defined on the workspace.
Out-of-sample testing
We select all strategies for each ETF to minimize selection bias. Selecting only the strategies with favorable performance from in-sample or from out-of-sample may cause to data snooping bias. We then have DLPAL S generate system code for Amibroker for each ETF and we combine the strategies in a single strategy. Out-of-sample is from 01/04/2010 to 02/06/2019. We allocate 25% of equity to IEF and 75% of equity to IJR. Below is the equity curve in out-of-sample. All backtests include commission of $0.01 per share.
Underwater equity curve is shown below:
CAGR is 5.1% and maximum drawdown is 4.8%. Sharpe is 1.16. There are 336 trades in the out-of-sample. Win rate is 58%.
The performance of the strategy is compared to a passive 75%/25% allocation in IJR/IEF in the out-of-sample.
Parameter | DLPAL S Strategy | Passive allocation |
CAGR | 5.1% | 7.02% |
Maximum drawdown | -4.8% | -9.2% |
Sharpe | 1.16 | 1.37 |
MAR (CAGR/Max. DD) | 1.01 | 0.77 |
Trades | 336 | – |
Win% | 58% | – |
The strategy outperforms the passive allocation in the out-of-sample on a risk-adjusted basis (MAR).
On could rebalance the DLPAL S strategies by running another search before a forward test since the in-sample test proved that the strategy is viable. Some users of DLPAL S rebalance every six months, others every year or two.
More information about DLPAL S can be found here.
More articles about using DLPAL S can be found here.
You can download a free demo of DLPAL S from this link.