Premium Market Analysis, Trader Education, Software, and Trading Strategies. Thirty Years Of Skin In The Game

DLPAL software

Trading Strategy for Gold Futures

In this article we use DLPAL S software to develop a short-term trading strategy for gold futures.

We follow the development process outlined in this article.

  1. Spit data in-sample and out-of sample.
  2. Understand the data using statistical analysis.
  3. Identify strategies in the in-sample.
  4. Test performance out-of-sample.
  5. Validate performance in out-of-sample.
  6. Use full history to develop new strategies.

We use daily continuous back-adjusted data from Norgate data. We highly recommend this data service to DLPAL customers because it is reliable and data are clean. (We do not have a referral arrangement with the company.)

Click here for more details
Step 1. Spit data in-sample and out-of sample.

We used the Data Partition tool in DLPAL S for this purpose.

Full history: 03/30/1978 – 02/10/2020
In-sample: 03/30/1978 – 12/31/2009
Out-of-sample: 01/04/2010-02/10/2020

Step 2. Understand the data using statistical analysis.

We use the Price Series Statistics tool from DLPAL S to analyze only the in-sample to avoid data snooping bias.

blank

Nearly 95% of the daily returns in the in-sample are between -1.23% +1.23%. We can then use 2% for profit target and stop-loss.

Step 3. Identify strategies in the in-sample.

We use the following DLPAL S workspace to identify strategies in the in-sample. The parameter settings are as shown below.

blank

DLPAL S identified 11 long and 42 short strategies that fulfilled the desired performance criteria specified on the workspace.

blank

We select the top 10 long and top 10 short strategies because we desire to have a well-balanced system without directional bias. The results are shown below.

blank

Step 4. Test performance out-of-sample.

We use DLPAL S generated code for Amibroker to backtest the above results in the whole data history. We use $50K initial capital and one contract for position size with no equity reinvestment.

blank

It may be seen that the strategy performance in out-of-sample is positive but volatile. However, there is no breakdown of performance in out-of-sample as it is usually the case with random strategies although it is lower than in-sample as expected.

Below is the backtest in the out-of-sample only.

blank

The strategy from the  in-sample lost about 40% in 2012 but gained 54% in 2013. This is attributed to the volatile nature of futures trading. Volatility also depends on initial capital: increasing the capital per contract lowers volatility.

In the out-of-sample, CARG is 6.4%, win rate is 51% and there are 146 and 150 short trades with a payoff ratio of about 1.

Step 5. Validate performance in out-of-sample.

We have just validated the integrity of DLPAL S strategy synthesis algorithm. We can now develop a new strategy on full history. This is Step 6.

Developing a final strategy on the full sample allows exposure to all market conditions in the data. Since we have already validated the strategy discovery process, the full strategy has high probability of performing well in forward sample.


More articles about using DLPAL S can be found here.

You can download a free demo of DLPAL S from this link.

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

Disclaimer