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 longonly trading simulation was run with the following capitalization, cost and exit settings:
 Maximum of 10 open positions
 Size each position at 10 % of marktomarket total capital
 Take no more than 3 new positions per day
 Compute the marktomarket 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 exitno 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 longonly 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 longonly 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 
Longonly 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  Longonly 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 uptrend 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 downtrend and
 When the DMI Stochastic is above the sell level
 Exit shorts when the DMI oscillator rises above the exit level of shorts
Captions:
Figure 1 – Threedimensional 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)





