TradersEdgeSystems.com

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

January 2013 Stocks and Commodities Traders Tips


The DMI Stochastic

AIQ Version:

Original article by Barbara Star, PhD
AIQ Code by Richard Denning

To test the author’s DMI Stochastic indicator, I used the NASDAQ 100 list of stocks and AIQ’s Portfolio Manager. A long-only trading simulation was run with the following capitalization, cost and exit settings:

  • Maximum of 10 open positions
  • Size each position at 10 % of mark-to-market total capital
  • Take no more than 3 new positions per day
  • Compute the mark-to-market capital each day
  • Three cents per share was deducted for each round turn trade
  • Select trades based on the highest ADX reading
  • Exit trades only with a system exit-no loss stop or profit target stop used

I coded three similar test systems. The first is the basic system that uses the author’s parameters of 10 (buy signal) & 90 (sell signal) on the DMI Stochastic indicator. A stock has a buy signal when it has both a positive DMI oscillator and the DMI Stochastic is below the buy level. In Figure 1, I show the resulting long-only equity curve compared to the S&P 500 index for the basic system with the 10 buy level parameter. For the period 12/30/94 to 11/09/2012, the system returned an average internal rate of return of 11.6% with a maximum drawdown of 68.7% on 2/6/2003 and a Sharpe ratio of 0.50.

I also tried changing the buy level parameter up to 70 improved the return somewhat. I added a trend filter using the 50 bar moving average of the S&P 500 index but result was to reduce the return without improving the maximum drawdown very much. The equity curve for this test is not shown. For the period 12/30/94 to 11/09/2012, the system returned an average internal rate of return of 8.5% with a maximum drawdown of 46.1% on 10/2/1998 and a Sharpe ratio of 0.46.

Lastly I tried adding an ADX filter such that the ADX level had to be above 30 to allow a signal but I also left the buy level at the high value of 70. In Figure 2, I show the resulting long-only equity curve compared for the basic system to the equity curve for this modified ADX system. For the period 12/30/94 to 11/09/2012, the system returned an average internal rate of return of 12.1% with a maximum drawdown of 56.1% on 2/6/2003 and a Sharpe ratio of 0.46.

Captions:
Figure 1 - Long-only equity curve (blue) compared to the S&P 500 (red) for the test period 12/30/94 to 11/09/12 trading the NASDAQ 100 list of stocks.

Figure 2 - Long-only equity curves compared: modified ADX system (blue) versus the basic system (red) for the test period 12/30/94 to 11/09/12 trading the NASDAQ 100 list of stocks.

EDS Code:
DMI Stoch.EDS
(right click and choose Save As)


 

Traders Studio Version :

Original article by Barbara Star, PhD
Traders Studio Code by Richard Denning

The following code files are provided in the zip file download below:

  • Function: “SD” a helper function that returns the slow D stochastic of the price inputs
  • Function: “DMI_STOCHASTIC” a function that returns the DMI Stochastic values
  • Indicator plot: “DMI_OSC_IND” indicator code that plots the DMI oscillator with a zero line
  • Indicator plot: “DMI_STOCHASTIC_IND” indicator code that plots the DMI Stochastic indicator with two horizontal lines for the buy level and the sell level
  • System: “DMI_STOCHASTIC_SYS” a system of my design to test the author’s indicator

Parameters:

  • lenDS = the length used for the DMI oscillator and the DMI Stochastic indicators
  • buyLvl = maximum value of DMI Stochastic for a buy signal
  • exitBuyLvl = minimum level on DMI oscillator before an exit for a long is generated
  • sellLvl = minimum value of DMI Stochastic for a sell signal
  • exitSellLvl = maximum level on DMI oscillator before an exit for a short is generated
  • longOnly when set to 1 trade long only; when set to 2 trade short only; when set to 0 trade both long and short

The rules of the test system are simple:

Go long when

  • DMI oscillator is greater than the exit level for longs indicating an up-trend and
  • When the DMI Stochastic is below the buy level
  • Exit longs when the DMI oscillator drops below the exit level for longs

Go short when

  • DMI oscillator is less than the exit level for shorts indicating a down-trend and
  • When the DMI Stochastic is above the sell level
  • Exit shorts when the DMI oscillator rises above the exit level of shorts
I set up a test session using the S&P 500 futures contract, SP, using Pinnacle data. I then optimized the parameters separately for the long and short side. Note that I did not optimize the length of the DMI but rather just used the author’s value of 10. Although trading both the long and short side together resulted in more profit, the equity curve became erratic compared to trading just the long side. In Figure 1, I show the parameter optimization map for trading just the long side with the system on the SP contract from 4/21/1982 through 11/9/2012. The buy level parameters between 65 and 80 together with the exit buy levels between -5 and +5 look good without any spikes in the map. I then ran a back test trading one contract for the same period with parameter set buy level = 70 and exit buy level = 0 trading long only. The resulting equity curve and underwater equity curve are shown in Figure 2. The system returned a profit of $163,650 with a maximum drawdown of $64,150 on 9/25/2002.

Captions:
Figure 1 – Three-dimensional parameter optimization graph for the system trading the SP futures contract for the period 1982 through 2012.

Figure 2 – Equity & underwater equity curves for the system using one of the better parameter sets from the optimization tests (buy level = 70, exit buy level = 0, long only).

Traders Studio Code:
DMI Stochastic.zip
(right click and choose Save As)

 

 

 

 

 

 

 

 

 

 

 

 

 

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