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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

28

STOCHASTICS AND AVERAGES AND RSI! OH, MY!

The ADX index incorporates moving averages of true range and both +DM

and −DM. Data averaging is also the same as data smoothing. A moving average

function cuts down the impact of abnormal data points and creates a more robust

model of the data. Wilder created his indicators without the use of a computer

and created a shortcut to average his data points. This Wilder’s smoothing is more

like an exponential calculation. Different trading/testing/charting platforms use

different smoothing functions for Wilder’s indicators, so be sure to check your

user’s manual and see which form is being utilized by your particular software.

Assuming a 14-day ADX length, Wilder would sum up the first 14-day values and

then divide by 14. Once these initial averages were calculated the subsequent bar

values were calculated by first dividing the previous sum by 14 and subtracting it

from the previous sum and then adding today’s values:

previous plusDM14

plusDM14 = previous plusDM14 − + plusDM today

14

This form of smoothing eliminates keeping track of the prior 14 bar values and

accomplishes the desired effect (reducing the impact of outlying data points) on

plus DM, minus DM, and true range. Remember, Wilder probably had the use of

just a calculator, and instead of inputting 42 numbers (summing three sets of 14

numbers), he simply used the above formula and whipped out the values in a minute

or less. Most of today’s charting software utilizes an exponential moving average to

smooth the ADX. This smoothing method creates results that can be quite different

than Wilder’s original method.

Wilders:

Exponential:

ADX =((priorADX ∗ 13)+DX)∕14

ADX = priorADX + 2∕15 ∗ (DX − priorADX)

The smoothing factor (2/(N+1)) or in this case (2/15) can be changed to (1/N)

to arrive at Wilder’s calculation. This becomes more like a 27 period exponential

moving average than a 14. However, this exponential method is considered accurate,

but, in some cases, different charting software will offer both versions: ADX and

Wilder ADX.

Calculation for a 14-day ADX:

1. Calculate the true range (TR), plus directional movement (+DM), and minus

directional movement (−DM) for each bar.

2. True range (TR ) = max(C[1],H) − min(C[1],L). In other words: Take the

higher of yesterday’s close and today’s high and subtract the lower of yesterday’s

close and today’s low. Basically, you are expanding today’s range to incorporate

the prior day’s close if it is outside of today’s range.

3. Smooth these periodic values using a 14-day moving average. You will either

have to wait until 14 days have transpired or you can simply look at 14 days of

prior history before commencing the ADX calculation.

www.rasabourse.com

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

Saved successfully!

Ooh no, something went wrong!