Trying to match DI +/- (ADX) to my Excel formula
Author: maninjapan
Creation Date: 3/21/2018 6:21 PM
profile picture

maninjapan

#1
I am trying to translate a strategy from excel to Wealth Lab based on the ADX indicator. I have found a few threads on ADX but none seem to cover the following in detail.

the way WLD calculates the indicator DIplus (and ADX) is described here:
http://www2.wealth-lab.com/WL5WIKI/Default.aspx?Page=DIPlus&NS=&AspxAutoDetectCookieSupport=1

My ADX values in excel and Wealth Lab are very different and would like to start from comparing +DM values to identify the difference. However, there doesn't appear to be an indicator for +DM (only +DI) and the above is a little open to interpretation. What would a formula covering the above look like? Or at least can someone confirm the following so that I can try and create my own.

1.What defines an up trending day? Close > Prev. Close ? -OR- Close > Open?
2. Do Inside days and outside days compare the open/Close or High/Low to previous day?
3. In the event of a trending day, if yesterdays high is higher than today's high, this would return a negative result. In this case do I use 0, ABS of the difference, or the negative result as is?

In excel a commonly used formula for +DM appears to be as follows but calculating DI based on these create noticeably different results.

=IF(High - Prev High > Prev Low - Low ,MAX(High - Prev. High,0),0)
- below as exact formula copied -
=IF(D16-D15>E15-E16,MAX(D16-D15,0),0)

Thanks in Advance
profile picture

Eugene

#2
I think it's counterproductive to spend time matching Wealth-Lab's time tested and correct ADX implementation with Excel formulas. It's up to you and I hope these pointers help in your quest as well as to discover the DIMinus page and answers to your questions on the ADX page in the Wiki:

Difference between WLP ADX & ATP ADX
ADX and DMI on DataSeries

As states the WealthScript Programming Guide (Indicators > Stability of Indicators), ADX is an unstable indicator and WL returns a more or less stable value from 3-4 times * ADX period bars.

Good luck with your venture!
profile picture

maninjapan

#3
Thanks for the reply Eugene, I have read all of the above and did spend considerable time reviewing the documentation on this(stability has been taken into account as well). I understand that some differences are to be expected, but in this case are wildly different from other sources of ADX. As I noted the explanation of +DM (and -DM) are not clear. Is it not possible to get the actual code that calculates the +/- DM?

The problem I have is I can not autotrade from Wealthlab, only backtest, so unless I can successfully translate my strategy into another platform that I can use to actually trade my strategy, my efforts to date will have been for naught.... So in this case it is not counterproductive.

Again, is it not possible to get the specific calculations used to calculate the +/- DM? The DI, DX and ADX are listed but there is no indicator for the DM indicator which the DI is based on.

Thanks
profile picture

Eugene

#4
Sorry, any standard indicator's code is closed source and we don't possess a documentation other than the Wiki has.

Why do you think you cannot autotrade? For WLD users like you, the turnkey solution created by a 3rd party together with IB's wide coverage of global instruments should make it possible. Check it out, it has a free 10-day trial.
profile picture

maninjapan

#5
Thanks Eugene, That may be one to check out in the future but The Products I am looking to trading for this strategy are not offered by IB.


Thanks anyway
profile picture

KGo

#6
The likely differences are use of Wilder's moving average and rounding values. Both are required by Wilder but often ignored.in implementations. WL used Wilders formulation. Attached is WL4 code posted by FundTimer years ago that gives his full formulation.
CODE:
Please log in to see this code.
profile picture

Eugene

#7
KGo, please always use the CODE tags when posting such code - not as file attachments. Thanks.
profile picture

maninjapan

#8
Much appreciated KGo!! I will go over this.
profile picture

maninjapan

#9
KGo, Thanks for the tips, I went back and checked for the rounding and Wilder MA, and sure enough it was not done correctly. I adjusted the formulas and was able to get the final ADX values to match as close as could be reasonable expected.

Very much appreciated!
profile picture

KGo

#10
You're welcome. Glad it helped.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).