Sei sulla pagina 1di 24

Wednesday, 15th November 2000

November Monthly Meeting

Directional Movement Indicators Evolution

Riccardo Ronco
BAPV rronco@bloomberg.net riccardo@rronco.freeserve.co.uk

Directional Movement

Directional movement is the most fascinating concept I have studied. Defining it is a little like chasing the end of a rainbow you can see it, you know its there, but the closer you get to it the more elusive it becomes. I have probably spent more time studying directional movement than any other concept. Certainly one of the most satisfying achievements was the day I was actually able to reduce this concept to an absolute mathematical equation WELLES WILDER

DMI formulas
This is reprinted in part from Volume 11, Issue 4,of the STOCKS & COMMODITIES article, "The ADX" by Thom Hartle. Figure 1 shows the five ADX cases that have to be resolved. In example A, the second day's trading range is higher than the first day's trading range, indicating positive directional movement. In example B, the second day's trading range is below the first day's trading range, an indication of negative directional movement. Example C is more complicated because the second day's range is both lower and higher than the first day's range. Directional movement is only considered to be up, down or not present. Therefore, the larger part of the day's range extending beyond the previous day's range is used to identify directional movement. In example C, the largest part of the second day is higher; consequently, the directional movement is positive. In example D, the largest part of the second day's range is lower so that the directional movement is negative. In example E, the second day's range is within the first day's range so the directional movement is zero. In the Excel 4.0 spreadsheet (Figure 2), the first calculation for ADX is the true range value (TR). This is performed in column E. The formula for cell E3 is: =MAX(B3-C3,ABS(B3-D2),ABS(C3-D2)) Next, column F determines the positive directional movement or returns zero if there is no positive directional movement. The formula for cell F3 is: =IF(B3-B2>C2-C3,MAX(B3-B2,0),0) Column G calculates the negative directional movement or returns zero if there is no negative directional movement. The formula for cell G3 is: =IF(C2-C3>B3-B2,MAX(C2-C3,0),0) The daily calculations are volatile and so the data needs to be smoothed. First, sum the last 14 periods for TR, +DM and - DM. The formula for summing the TR is in cell H16: =SUM(E3:E16) ADX spreadsheet. Here is the output for the S&P 500 from January 1 to February 11, 1992. The formula for summing the +DM is in cell I16: =SUM(F3:F16) The formula for summing the -DM is in cell J16: =SUM(G3:G16) The smoothing formula for the TR14 column begins at cell H17: =TRUNC((H16-(H16/14)+E17),3) The smoothing formula subtracts 1/14th of yesterday's TR14 from yesterday's TR14 and then adds today's TR value. The truncating function is used to calculate the indicator as close as possible to the developer of the ADX's original form of calculation (which was done by hand). The smoothing formula for the +DM14 column begins at cell I17: =TRUNC((I16-(I16/14)+F17),3) The smoothing formula subtracts 1/14th of yesterday's +DM14 from yesterday's +DM14 and then adds today's +DM value. The smoothing formula for the -DM14 column begins at cell J17: =TRUNC((J16(J16/14)+G17),3) The smoothing formula subtracts 1/14th of yesterday's -DM14 value from yesterday's -DM14 and then adds today's -DM value. Now we have a 14-day smoothed sum of TR, +DM and -DM. The next step is to calculate the ratios of +DM and -DM to TR. The ratios are called the +directional indicator (+DI) and directional indicator (-DI). The formula for the +DI column begins at cell K16: =INT(100*(I16/H16)) The formula for the +DI column begins at cell L16: =INT(100*(J16/H16)) The integer function (INT) is used because the original developer dropped the values after the decimal in the original work on the ADX indicator. The next step is to calculate the absolute value of the difference between the +DI and the -DI. This is done in column M and the formula for cell M16:=ABS(K16-L16) The next column calculates the sum of the +DI and -DI. The formula for cell N16: =K16+L16 The next step is to calculate the DX, which is the ratio of the absolute value of the difference between the +DI and the -DI divided by the sum of the +DI and the -DI. This is done in column O. The formula for cell O16: =INT(100*(M16/N16)) The final step is smoothing the DX to arrive at the value of the ADX. First, average the last 14 days of DX values. The formula for cell P28: =AVERAGE(O15:O28) The smoothing process uses yesterday's ADX value multiplied by 13, and then add today's DX value. Finally, divide this sum by 14. The formula for cell P29: =INT(((P28*13)+O29)/14) Additional reading Wilder, J. Welles [1978]. New Concepts in Technical Trading Systems, Trend Research.

Common Interpretations and Trading Systems


Original Wilder rules 1. Buy when DM+ crosses above DM- and Sell when DM- crosses above DM+ 2. Extreme Point Rule (EPR): - if LONG the reverse point is the extreme point (the LOW) made on the day of crossing; - if SHORT the reverse point is the extreme point (the HIGH) made on the day of crossing; 3. Stay with these reversals even if the indexes stay crossed contrary to your position. Hochheimer rules (with delay) 1. Buy when DM+ crosses above DM- entering a BUY STOP on the next day using todays high price. 2. Sell when DM- crosses above DM+ entering a SELL STOP on the next day using todays low price. Hochheimer rules (immediate entry with no filter) 1. Buy when DM+ crosses above DM- on the open of the next day. 2. Sell when DM- crosses above DM+ on the open of the next day. Directional Parabolic System (DRP: 2 parameters only) 1. Buy when DM+ crosses above DM- at the parabolic stop. 2. Sell when DM- crosses above DM+ at the parabolic stop. 3. Exit always at the parabolic stop.

DMI Problems and Features

1.

Same problem that a simple / exponential moving average with the same DMI length can have, that is: it does not work in a choppy market because of many false signals.

2.

DMI crossover indicates the trend direction in the same way the direction of the moving average or the crossover of the close with its moving average does, so it looks like that there is no particular advantage in using DMI versus a moving average.

3.

Common risk in over optimization when developing trading systems using DMI to fit a given time series.

DMI Evolution part 1


The contrarian approach We can use the DM indicators in a contrarian way: 1. To identify low risk buy / sell opportunities or 2. To locate exhaustion points where it is better to close positions, at least
Code to test and visualize this pattern in Tradestation is provided.

A) It is actually possible to find interesting bottom / top patterns to trade or to insert in our existing trading systems (plenty of space to improve this pattern). B) There are 3 parameters (DM indicator length, threshold level, number of days to exit) so, again, the risk in over fitting is still here C) Testing stocks using daily bars we find that: - DM indicator interesting length is between 3 6 days (short term trading only then); - The threshold level is between 5 and 10 (really oversold / overbought conditions); - Ideal profitable holding period goes from 5 to 10 days; - ~ 55% profitable; - Profit factor (gross profit / gross losses) between 1.15 1.35; - Ratio average win / average loss ~ 1.00 (ideal for short term only).

Easy Language Code for DMI Evolution part I


{System: DMI Exhaustion Test adapted for STA Meeting 15th November 2000 Coded by Riccardo Ronco 1995 2000 riccardo@rronco.freeserve.co.uk} Input: Length(10),Level(5),Exit(5); IF DMIPlus(Length) <= Level Then Buy at Market; IF marketposition > 0 and barssinceentry = Exit Then ExitLong on Close; IF DMIMinus(Length) <= Level Then Sell at Market; IF marketposition < 0 and barssinceentry = Exit Then ExitShort on Close;

{Show Me Study: DMI Exhaustion Test adapted for STA Meeting 15th November 2000 Coded by Riccardo Ronco 1995 2000 riccardo@rronco.freeserve.co.uk} Input: Length(5),Level(5); IF DMIPlus(Length) <= Level Then Begin Plot1(Low - 5 points,"DMI Ex Low"); IF CheckAlert Then Alert = TRUE; End; IF DMIMinus(Length) <= Level Then Begin Plot2(High + 5 points,"DMI Ex High"); IF CheckAlert Then Alert = TRUE; End;

DMI Evolution part 2


One step towards a better structure? In 1995 while I was observing the expansion and contraction of the DM indicators, I started to develop a more interesting way to interpret the DMI set, that is: 1. DM+ and DM- are plotted separately (BULL BEAR pressure); 2. ADX and ADXR are not considered here since they lag too much; 3. A moving average is plotted on each DM indicator to confirm trend direction; 4. It is possible to see positive and negative divergences in a better way; 5. Congestion is now identified by the slope of the 2 averages that has to be negative for both.

Code for the DMI Evolution Trading System is provided.

The DMI Evolution Trading System

a) b) c) d) e) f) g)

It is always in the market (Stop and Reverse); For a LONG position (BUY Setup) the DM+ is above its moving average AND the DM- is below its moving average; For a SHORT position (SELL Setup) the DM+ is below its moving average AND the DM- is above its moving average; BUY on breakout of the High of the day we have a BUY setup; SELL on breakout of the Low of the day we have a SELL setup; A condition to exit the position when congestion is detected can be added to reduce the time spent in the market; Testing results are consistent and stable trough a wide range of parameters.

Easy Language Code for DMI Evolution part II

{System: DMI Evolution Trading System Stop and Reverse, Trend Following, No commissions, no slippage, no reinvestment Setup: DMI direction confirmed by BOTH exp moving averages Entry: Breakout next bar (High for LONG, Low for SHORT) adapted for STA Meeting 15th November 2000 Coded by Riccardo Ronco 1995 2000 riccardo@rronco.freeserve.co.uk} Input: Length(14),Ema(3); IF (DMIPlus(Length) > Xaverage(DMIPlus(Length),Ema)) and (DMIMinus(Length) < Xaverage(DMIMinus(Length),Ema)) Then Buy High + 1 point Stop; IF (DMIPlus(Length) < Xaverage(DMIPlus(Length),Ema)) and (DMIMinus(Length) > Xaverage(DMIMinus(Length),Ema)) Then Sell Low - 1 point Stop;

DMI Evolution part 3


DMI PEAKS - The structure? After looking at the DMI Evolution charts for few months I started to concentrate my attention more on the concepts of BULL pressure (DM+) and BEAR pressure (DM-) and on the way these two indicators were behaving with the passing of time. The sequence of peaks on the single indicators was able to define interesting breakout points while the sequence of troughs acted as important pivots to better define the strength of the current trend, especially on weekly charts. The testing results do not change beyond a certain parameter value (one only) suggesting that this methodology is consistent and is able to pick true pivotal supports and resistances. I then defined, given a particular strength value, 4 price levels to quantify my price structure (strength = required number of higher / lower bars on either side of the indicators to obtain a troughs / peak). The higher the strength, the more important the levels obtained. Here Ill consider a strength value of ONE. We are not simply taking the highest high / lowest low of the last 2 days: we are using only those qualified by particular DMI patterns offering a whole new field open to further exploration.

The Structure
DMI PEAK structure (Strength = 1)

DM+
Long Entry on b/o Highest High last 2 bars

DMShort Entry on b/o Lowest Low last 2 bars

Peak

Trough

Long Exit on b/o Lowest Low last 2 bars

Short Exit on b/o Highest High last 2 bars

Code for the DMI Peaks Trading System is provided.

Easy Language Code for DMI Evolution part III


{Function: DMIPeaks Long Entry A Strenght 1 DMI+ peak is defined by one preceding and one following bars with LOWER DMI + values. When this condition is found we save the HIGHEST HIGH of the last two bars since this value is a bullish breakout level adapted for STA Meeting 15th November 2000 Coded by Riccardo Ronco riccardo@rronco.freeserve.co.uk} Input: Len(Numeric); Value1 = DMIPlus(Len); DMIPLE = IFF( value1 <= value1[1] and value1[1] > value1[2], Highest(High, 2), DMIPLE[1]);

{Function: DMIPeaks Long Exit A Strenght 1 DMI+ trough is defined by one preceding and one following bars with HIGHER DMI+ values. When this condition is found we save the LOWEST LOW of the last two bars since this value is a support level adapted for STA Meeting 15th November 2000 Coded by Riccardo Ronco riccardo@rronco.freeserve.co.uk} Input: Len(Numeric); Value1 = DMIPlus(Len); DMIPLX = IFF( value1 > value1[1] and value1[1] < value1[2], Lowest(Low, 2), DMIPLX[1]);

{Function: DMIPeaks Short Entry A Strenght 1 DMI- peak is defined by one preceding and one following bars with LOWER DMIvalues. When this condition is found we save the LOWEST LOW of the last two bars since this value is a bearish breakout level adapted for STA Meeting 15th November 2000 Coded by Riccardo Ronco riccardo@rronco.freeserve.co.uk} Input: Len(Numeric); Value1 = DMIMinus(Len); DMIPSE = IFF( value1 <= value1[1] and value1[1] > value1[2], Lowest(Low, 2), DMIPSE[1]);

{Function: DMIPeaks Short Exit A Strenght 1 DMI- trough is defined by one preceding and one following bars with HIGHER DMI- values. When this condition is found we save the HIGHEST HIGH of the last two bars since this value is a resistance level adapted for STA Meeting 15th November 2000 Coded by Riccardo Ronco riccardo@rronco.freeserve.co.uk} Input: Len(Numeric); Value1 = DMIMinus(Len); DMIPSX = IFF( value1 > value1[1] and value1[1] < value1[2], Highest(High, 2), DMIPSX[1]);

{System: DMI Peaks adapted for STA Meeting 15th November 2000 Coded by Riccardo Ronco riccardo@rronco.freeserve.co.uk} Inputs: Length(9); Vars: mp(0); mp = marketposition; Buy DMIPLE(Length) + 1 point stop; Sell DMIPSE(Length) - 1 point stop; if mp > 0 then Exitlong DMIPLX(Length) - 1 point stop; if mp < 0 then Exitshort DMIPSX(Length) + 1 point stop;

{Indicator: DMI Peaks adapted for STA Meeting 15th November 2000 Coded by Riccardo Ronco riccardo@rronco.freeserve.co.uk} Input: Length(9); Plot1(DMIPLE(Length),"DMIPLE"); Plot2(DMIPLX(Length),"DMIPLX"); Plot3(DMIPSE(Length),"DMIPSE"); Plot4(DMIPSX(Length),"DMIPSX"); IF CheckAlert Then Begin IF Plot1 Crosses Above Plot2 or or Plot1 Crosses Above Plot3 or or Plot1 Crosses Above Plot4 or or Plot2 Crosses Above Plot3 or or Plot2 Crosses Above Plot4 or or Plot3 Crosses Above Plot4 or Then Alert = TRUE; End;

Plot1 Plot1 Plot1 Plot2 Plot2 Plot3

Crosses Crosses Crosses Crosses Crosses Crosses

Below Below Below Below Below Below

Plot2 Plot3 Plot4 Plot3 Plot4 Plot4

References

1. 2. 3. 4. 5. 6. 7. 8.

Wilder, J.Welles [1978]. New Concepts In Technical Trading Systems, Trend Research. Hochheimer Vaughn [1982]. Computerized Trading Techniques, Merrill Lynch Comm. Lukac, Brorsen, Irwin [1985]. A Comparison of 12 Trading Systems, Traders Press. LeBeau Lucas [1992]. Computer Analysis Of The Futures Market, Business One Irwin. Blau, William [1995]. Momentum, Direction And Divergence, John Wiley & Sons. Chande, Tushar S. [1997]. Beyond Technical Analysis, John Wiley & Sons. Kaufman, Perry J. [1998]. Trading Systems And Methods (3rd ed.), John Wiley & Sons. Evens, Stuart [1999]. Stocks & Commodities Feb 199 p. 66.

Potrebbero piacerti anche