TradersEdgeSystems.com

Consulting | Custom Trading Systems
Built-In Indicators | Custom Indicators

August 2009 Stocks and Commodities Traders Tips


Combining DMI and Moving Average For a EUR/USD Trading System

Original article by Rombout Kerstens
AIQ Code by Richard Denning
Traders Studio Code by Richard Denning

AIQ Version:

The AIQ code for the three trend following systems from the article, “Combining DMA and Moving Average…Trading System” by Rombout Kerstens, is shown below. In the article, the author applies the systems to a single market, the EUR/USD forex pair. I decided to try the systems on stocks using the Russell 1000 list. The systems suggested by the author do not include a sorting algorithm to choose trades when there are more trades than we can take on any single day based on our capitalization and position sizing rules. I added code for the AIQ relative strength indicator for this purpose. I used a test period of 6/01/1990 to 6/12/09 and focused the tests on the combined DMI and MA system. The initial tests for trading long only showed that the drawdown was in excess of 57% and trading short only showed a complete loss of the initial capital for the test period. Because of these issues, I added a market timing filter that trades long only when the S&P 500 index is above its 250 day moving average and short only when below this average.

Caption for Figure 1:
Figure 1: I show the equity curve (blue line) using the author’s parameters with the market timing filter trading long only. The average return of the system significantly outperformed the S&P 500 index (SPX), the red line in Figure 1. The short side, even with the market timing filter, did not work, losing all of the initial capital.

AIQ EDS Code for Combining DMI and Moving Average For EUR/USD Trading System:
(RIGHT-CLICK AND CHOOSE "SAVE FILE AS" OR "SAVE LINK AS")
MA_DMI.EDS



Traders Studio Version:

The TradersStudio code for DMI and moving average trading system and the related functions in the article, “Combining DMI and Moving Average…Trading System” by Rombout Kerstens, is shown below. The coded version that I have supplied is really three systems in one with an input variable called “sysType” that sets which system is being run. Explanation of the settings is found at the very beginning of the code for the system.

Instead of just repeating the author’s test on the single market, I created a portfolio of 38 of the more actively traded, full sized, futures contracts. I used Pinnacle back-adjusted data (day session only) for the following symbols: AD, BO, BP, C, CC, CD, CL, CT, DJ, DX, ED, FA, FC, FX, GC, HG, HO, HU, JO, JY, KC, KW, LC, LH, NG, NK, PB, RB, S, SB, SF, SI, SM, SP, TA, TD, UA, W. I first ran the portfolio from 1990 to 2009 with the parameters the author used for the forex pair EUR/USD but the results were not particularly good. I then ran optimizations on each system to determine the most robust range for the parameters. For the moving average system, this turned out to be between 30 and 80 days (see Figure 1) and for the DMI system, this turned out to be from 18 to 26 (see Figure 2). For the combined system, in Figure 3, I show the three dimensional plot of the two parameters against net profit. Using the parameter set 28, 35, 3 the combined system was profitable on 71% of the markets.

Captions for Figures:

Figure 1: Parameter optimization graph of moving average length versus net profit for a portfolio of 38 futures contracts for the period from 5/30/1990 to 6/09/2009.

Figure 2: Parameter optimization graph of DMI length versus net profit for a portfolio of 38 futures contracts for the period from 5/30/1990 to 6/09/2009.

Figure 3: Three dimensional graph of the combined system using both the moving average and the DMI parameter optimization versus net profit for a portfolio of 38 futures contracts for the period from 5/30/1990 to 6/09/2009.

Traders Studio Code for Combining DMI and MA for EUR/USD Trading System:
DMI_MA System.zip

 

 

 

 

 

 

 

 

 

 

 

 

 

Disclaimer | Privacy Policy | Contact Us | Spam Blocker | ©2009 Traders Edge Systems