31.07.2021 Views

Ultimate Algorithmic Trading System

Using automated systems for trading in stock markets

Using automated systems for trading in stock markets

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

a trending market condition, whereas a falling ADX is saying the market has stopped

trending and is entering a congestion phase. This information is very useful but very

limited as well. The computer cannot determine which way the market is trending

by simply looking at the ADX value. The solution to this problem can be found by

comparing the +DI to the −DI. If the +DI crosses above the −DI, then the market is

considered in an uptrend. When the −DI crosses above the +DI, then the market

is in a downtrend.

Using this indicator in concert with a trend-following system may produce more

robust entry signals. I have seen many systems incorporating the ADX in an attempt

to eliminate ‘‘whipsaw’’ trades. Welles Wilder developed his own system around the

ADX, +DI, and −DI. Box 2.1 is a description of a system that incorporates the ADX

and a trailing stop for both long and short trades. The stop will get out of longs when

the market closes lower than the prior three-day closings and get out of shorts when

the market closes higher than the prior three days. This type of stop is not fixed as

it varies based on market movement. In other words, it is a dynamic stop. If we are

lucky to get in on a nice intermediate trend, the stop will follow the market in the

direction of the movement and hopefully lock in some profit.

Box 2.1 Welles Wilder’s Directional Movement System Description

30

STOCHASTICS AND AVERAGES AND RSI! OH, MY!

If 14-day ADX is greater than 35 then

If +DI > −DI, then Buy market on close

If −DI > +DI, then SellShort market on close

If 14-day ADX is less than 35, then

If position is long and close is less than lowest close of prior three days, then

Sell market on close.

If position is short and close is greater than highest close of prior three days,

then BuyToCover market on close.

Welles Wilder’s Directional Movement p–code

‘Wilder’s Directional Movement System

‘Assuming Wilder’s Indicator/Functions are built–in

‘Also Highest and Lowest functions

myADX = ADX(14) ‘14 period ADX calculation

myPlusDI = PDI(14) ‘ 14 period Plus DI

myMinusDI = MDI(14) ‘ 14 period Minus DI

if myADX > 35 then

if myPlusDI > myMinusDI then

Buy this bar on close

if myMinusDI > myPlusDI then

SellShort this bar on close

www.rasabourse.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!