DMI Lecture

24
Wednesday, 15 th November 2000 November Monthly Meeting Directional Movement Indicators Evolution Riccardo Ronco BAPV [email protected] [email protected]

Transcript of DMI Lecture

Page 1: DMI Lecture

Wednesday, 15th November 2000

November Monthly Meeting

Directional Movement Indicators Evolution

Riccardo RoncoBAPV

[email protected]@rronco.freeserve.co.uk

Page 2: DMI Lecture

Directional Movement

“Directional movement is the most fascinating concept Ihave studied. Defining it is a little like chasing the end of arainbow… you can see it, you know it’s there, but the closeryou get to it the more elusive it becomes. I have probablyspent more time studying directional movement than anyother concept. Certainly one of the most satisfyingachievements was the day I was actually able to reduce thisconcept to an absolute mathematical equation”– WELLES WILDER

Page 3: DMI Lecture

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 rangeis higher than the first day's trading range, indicating positive directional movement. In example B, thesecond day's trading range is below the first day's trading range, an indication of negative directionalmovement. Example C is more complicated because the second day's range is both lower and higher thanthe first day's range. Directional movement is only considered to be up, down or not present. Therefore, thelarger part of the day's range extending beyond the previous day's range is used to identify directionalmovement. In example C, the largest part of the second day is higher; consequently, the directionalmovement is positive. In example D, the largest part of the second day's range is lower so that thedirectional movement is negative. In example E, the second day's range is within the first day's range so thedirectional movement is zero. In the Excel 4.0 spreadsheet (Figure 2), the first calculation for ADX is thetrue 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 positivedirectional 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 directionalmovement. 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 forTR, +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'sTR value. The truncating function is used to calculate the indicator as close as possible to the developer ofthe ADX's original form of calculation (which was done by hand). The smoothing formula for the +DM14column 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 addstoday'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 thenadds today's -DM value. Now we have a 14-day smoothed sum of TR, +DM and -DM. The next step is tocalculate 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 inthe original work on the ADX indicator. The next step is to calculate the absolute value of the differencebetween 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+L16The 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 cellO16: =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 DXvalues. 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 readingWilder, J. Welles [1978]. New Concepts in Technical Trading Systems, Trend Research.

Page 4: DMI Lecture

Common Interpretations andTrading 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 today’s high price.2. Sell when DM- crosses above DM+ entering a SELL STOP on the next day using today’s 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.

Page 5: DMI Lecture

DMI Problems and Features

1. Same problem that a simple / exponential moving average withthe same DMI length can have, that is:

it does not work in a choppy marketbecause of many false signals.

2. DMI crossover indicates the trend direction in the same way thedirection of the moving average or the crossover of the closewith 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 tradingsystems using DMI to “fit” a given time series.

Page 6: DMI Lecture
Page 7: DMI Lecture

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 or2. 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 ourexisting 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).

Page 8: DMI Lecture
Page 9: DMI Lecture

Easy Language Code for DMI Evolution part I

{System: DMI Exhaustion Test

adapted for STA Meeting 15th November 2000Coded by Riccardo Ronco © 1995 – [email protected]}

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 2000Coded by Riccardo Ronco © 1995 – [email protected]}

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;

Page 10: DMI Lecture

DMI Evolution part 2

One step towards a better structure?

In 1995 while I was observing the expansion and contraction of the DM indicators, Istarted 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 forboth.

Code for the DMI Evolution Trading System is provided.

Page 11: DMI Lecture
Page 12: DMI Lecture
Page 13: DMI Lecture
Page 14: DMI Lecture

The DMI Evolution Trading System

a) It is always in the market (Stop and Reverse);

b) For a LONG position (BUY Setup) the DM+ is above its movingaverage AND the DM- is below its moving average;

c) For a SHORT position (SELL Setup) the DM+ is below its movingaverage AND the DM- is above its moving average;

d) BUY on breakout of the High of the day we have a BUY setup;

e) SELL on breakout of the Low of the day we have a SELL setup;

f) A condition to exit the position when congestion is detected canbe added to reduce the time spent in the market;

g) Testing results are consistent and stable trough a wide range ofparameters.

Page 15: DMI Lecture
Page 16: DMI Lecture

Easy Language Code for DMI Evolution part II

{System: DMI Evolution Trading System

Stop and Reverse, Trend Following, No commissions, no slippage, no reinvestmentSetup: DMI direction confirmed by BOTH exp moving averagesEntry: Breakout next bar (High for LONG, Low for SHORT)

adapted for STA Meeting 15th November 2000Coded by Riccardo Ronco © 1995 – [email protected]}

Input: Length(14),Ema(3);IF (DMIPlus(Length) > Xaverage(DMIPlus(Length),Ema)) and

(DMIMinus(Length) < Xaverage(DMIMinus(Length),Ema)) ThenBuy High + 1 point Stop;

IF (DMIPlus(Length) < Xaverage(DMIPlus(Length),Ema)) and(DMIMinus(Length) > Xaverage(DMIMinus(Length),Ema)) Then

Sell Low - 1 point Stop;

Page 17: DMI Lecture

DMI Evolution part 3

DMI PEAKS - The structure?

After looking at the DMI Evolution charts for few months I started toconcentrate my attention more on the concepts of BULL pressure(DM+) and BEAR pressure (DM-) and on the way these two indicatorswere behaving with the passing of time.

The sequence of peaks on the single indicators was able to defineinteresting breakout points while the sequence of troughs acted asimportant pivots to better define the strength of the current trend,especially on weekly charts. The testing results do not changebeyond a certain parameter value (one only) suggesting that thismethodology is consistent and is able to pick true pivotal supports andresistances.

I then defined, given a particular strength value, 4 price levels toquantify 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 levelsobtained. Here I’ll consider a strength value of ONE.

We are not simply taking the highest high / lowest low of the last 2days: we are using only those qualified by particular DMI patternsoffering a whole new field open to further exploration.

Page 18: DMI Lecture

The “Structure”

DMI PEAK structure(Strength = 1)

DM+ DM-

PeakLong Entry on b/oHighest High last 2

bars

Short Entry on b/oLowest Low last 2

bars

TroughLong Exit on b/o

Lowest Low last 2bars

Short Exit on b/oHighest High last 2

bars

Code for the DMI Peaks Trading System is provided.

Page 19: DMI Lecture
Page 20: DMI Lecture
Page 21: DMI Lecture

Easy Language Code for DMI Evolution part III

{Function: DMIPeaks Long EntryA 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 barssince this value is a bullish breakout level

adapted for STA Meeting 15th November 2000Coded by Riccardo Ronco [email protected]}

Input: Len(Numeric);Value1 = DMIPlus(Len);DMIPLE = IFF( value1 <= value1[1] and value1[1] > value1[2], Highest(High, 2),DMIPLE[1]);

{Function: DMIPeaks Long ExitA Strenght 1 DMI+ trough is defined by one preceding and one following bars with HIGHERDMI+ values. When this condition is found we save the LOWEST LOW of the last two barssince this value is a support level

adapted for STA Meeting 15th November 2000Coded by Riccardo Ronco [email protected]}

Input: Len(Numeric);Value1 = DMIPlus(Len);DMIPLX = IFF( value1 > value1[1] and value1[1] < value1[2], Lowest(Low, 2), DMIPLX[1]);

Page 22: DMI Lecture

{Function: DMIPeaks Short EntryA 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 LOWEST LOW of the last two bars sincethis value is a bearish breakout level

adapted for STA Meeting 15th November 2000Coded by Riccardo Ronco [email protected]}

Input: Len(Numeric);Value1 = DMIMinus(Len);DMIPSE = IFF( value1 <= value1[1] and value1[1] > value1[2], Lowest(Low, 2), DMIPSE[1]);

{Function: DMIPeaks Short ExitA Strenght 1 DMI- trough is defined by one preceding and one following bars with HIGHERDMI- values. When this condition is found we save the HIGHEST HIGH of the last two barssince this value is a resistance level

adapted for STA Meeting 15th November 2000Coded by Riccardo Ronco [email protected]}

Input: Len(Numeric);Value1 = DMIMinus(Len);DMIPSX = IFF( value1 > value1[1] and value1[1] < value1[2], Highest(High, 2), DMIPSX[1]);

Page 23: DMI Lecture

{System: DMI Peaks

adapted for STA Meeting 15th November 2000Coded by Riccardo Ronco [email protected]}

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 Peaksadapted for STA Meeting 15th November 2000Coded by Riccardo Ronco [email protected]}

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 Plot1 Crosses Below Plot2 or Plot1 Crosses Above Plot3 or Plot1 Crosses Below Plot3 or Plot1 Crosses Above Plot4 or Plot1 Crosses Below Plot4 or Plot2 Crosses Above Plot3 or Plot2 Crosses Below Plot3 or Plot2 Crosses Above Plot4 or Plot2 Crosses Below Plot4 or Plot3 Crosses Above Plot4 or Plot3 Crosses Below Plot4 Then Alert = TRUE;End;

Page 24: DMI Lecture

References

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