Premium Market Analysis, Trader Education, Software, and Trading Strategies

DLPAL software, Trading Strategies

Trading Strategy Development With DLPAL: Part Five

In this article we outline the steps for developing a trading strategy for TLT ETF using the delay trade input option. Out-of-sample performance is analyzed in Amibroker and Quantopian platform.

From the DLPAL manual on “Using Trade Input Delay

Strategies with a trade input delay are often useful in short-term trading because the delay can act as a filter of price corrections. DLPAL determines the best value of the delay for the strategies it discovers based on the range of values specified by the user.

In the article we make use of strategies with delay.  The following steps will be followed in developing a trading strategy for XLF ETF:

  1. Data partition
  2. Statistical analysis
  3. Workspace construction
  4. Results and Code generation
  5. Out-of-sample performance

 1. Data partition

We will first partition the data for TLT in in-sample and out-of-sample. The in-sample covers inception (07/30/2002) to 12/31/2010. The out-of-sample is from 01/03/2011 to 01/20/2017. We use the Data Partition tool in DLPAL to affect the data split for all 12 ETFs in directory C:/ETFDATA, as follows:

The in-sample files are saved in a subdirectory called Insample and the out-of-sample files are saved in the subdirectory Ossample. These subdirectories are generated automatically by DLPAL.

2. Statistical analysis

Before developing a strategy for TLT, or any other security, it is important to perform basic statistical analysis in the in-sample to determine the characteristics of the price series. We can use the Price Series Statistics tool of DLPAL for this purpose.

Note that 94.35% of the daily returns fall within -1.6283% and +1.6835%. Therefore, 1.5% percent profit target and stop-loss should be an appropriate value. We want our strategy to have timing ability. If the appropriate values for the exits are not used, we risk over-fitting to the data or getting stopped out to often. Normally we should try to use profit target and a stop-loss levels that are realistic.

3. Workspace construction.

For strategy development we use a search workspace where we define the in-sample data, the exit levels, the performance constraints, the major feature cluster to use and the test sample, as shown below.

For this search we selected in-sample TLT data and a T/S file we have prepared that corresponds to 1.5% exits. We also specify minimum win rate of 66% for each strategy reported, long or short, minimum profit factor of 1.5 and at least 30 trades (> 29). We choose the Close feature cluster and a test sample size of 500 bars. The trade input is the open and the exits are of percent type.

We also specify a Delay in the 1 to 3 bar range. DLPAL will determine the best value for the delay for each strategy. In some cases the delay may be set to 0. The delay value spcifies how many bars to wait after the strategy generates a signal before placing the trade. The objective is to avoid immediate corrections after signal generation.

There are other options available for most advanced search operations we do not consider in this example.

4. Results and Code Generation

The results of the search are shown below:

DLPAL identified 35 distinct strategies, 32 long and 3 short. The delay values for each strategy are indicated after Open in Trade On column. Note that by definition, the performance of the strategies in the in-sample is always good because they are selected to fulfill the performance objectives.  However, this is not useful as far as determining whether the strategies have timing ability because they may be random. Note that random strategies can be the result of any combination of the following:

  • Machine learning is inefficient
  • Parameters were not chosen correctly
  • Market is too efficient for strategy timing
  • There is insufficient data and market conditions
  • Other known and unknown factors

We can test in out-of-sample any of the strategies individually or elect to test a system that combines all strategies with the OR Boolean operator. In this case we generate code for the Amibroker and Quantopian platforms using the appropriate tools from DLPAL results and we then test the strategies in the out-of-sample. The Quantopian backtest is supposed to be more realistic because it applies the exits in 1-minute data and the platform accounts for partial fills and commissions based on a proprietary liquidity algorithm. Also note that the DLPAL code generation in all cases takes into account the delay values.

5. Out-of-sample performance

The out-of-sample performance from 01/03/2011 to 01/20/2017 in Amibroker platform is shown below. Note that the backtest is based on fully invested equity and $0.01 per share commission.

The middle pane shows buy and hold performance. Buy and hold CAR is 7.22% and Sharpe is 0.49. Maximum drawdown is -20.66%.

The strategy CAR is 7.06% and Sharpe is higher at 0.64. Maximum drawdown is significantly lower at -13.22%.

The out-of-sample performance from 01/03/2011 to 01/20/2017 in the Quantopian platform is shown below.

Total return is about 50% but in this platform the benchmark is SPY. Sharpe is 0.65, nearly equal to the value calculated in Amibroker. Maximum drawdown is slightly higher at -14.11%.

Next, we use the Random Trading Simulation tool of DLPAL to test the significance of the strategy in out-of-sample. We specify 50% for the test return and DLPAL performs the simulation, as shown below:

It may be seen that the minimum significant return for long-only random trading is 44.28% and our test return of 50% exceeds that. P-value based on this test is 0.0365.

Reproducible results

The results of DLPAL are fully reproducible for same data and parameters. This is one key aspect of DLPAL that allows scientific testing. There are several programs that claim to develop strategies but their output is random since each time they run they produce different results, which cannot be analyzed for significance because they cannot be reproduced. DLPAL has elevated strategy design and machine learning to the status of the scientific method by offering fully reproducible results.

If you have any questions or comments, happy to connect on Twitter: @priceactionlab

You can download a demo of DLPAL from this link. For more articles about DLPAL and DLPAL PRO click here.

Subscribe via RSS or Email, or follow us on Twitter.


Copyright Notice