Stock Scanner Adventures in Technical Analysis, or How to Compute the ADX
Stock Scanner Adventures in Technical Analysis, or How to Compute the ADX
May 17, 2010
When people watch our real-time stock scanner, they sometimes say that our formulas don’t look exactly like what their trading or charting software says it should look like. We try to minimize this, but there’s only so much we can do. When doing millions of real-time computations a second, there’s bound to be something that you disagree with. Most of the time the difference is small. However, the ADX indicator turned out to be one of the most inconsistently defined indicators that we’ve come across.
We recently changed our ADX to look more like what eSignal says. It used to look more like RealTick. What’s the difference? The primary difference is using a Wells Wilder sum vs. a traditional EMA.
What’s the difference? Sadly, the difference is mostly terminology. Some people talk about an EMA in terms of %, and other people talk about it in terms of bars. The % version seems to be more consistent. When you talk about N bars of smoothing, that can mean two different things. It can mean that the most recent value represents (2/(N+1))*100% of the most recent EMA. Or it can mean that the most recent value represents (1/N)*100% of the most recent EMA.
I say “sadly” because neither of these gives you any more power than the other. Do some quick algebra and you can see what I’m talking about. Let’s say that you’re used to using a charting package that uses the first formula, and you always used 14 bars as an input. Now you switch to a charting package that uses the second formula. You can type 6.5 in as an input to the new charting package, and you will get exactly the same results. Just one catch. Most charting packages won’t let me enter 6.5 into that field! Again, there’s no mathematical rationale for that, but it’s common. However, if you type 6 or 7 into that field, you will see a result that is generally similar to typing 14 into the other charting package.
So, which version of the formula does your software use? Don’t ask me! They’re all different. And which one is right? I’ve reviewed a lot of sources, and they all seem to say different things. I like this one, because it lists multiple answers. Average Directional Movement Index ADX Formula in C# | Dinosaur Technology and Trading If you don’t like that opinion, Google can give you a lot more.
There are other small differences. Some people like to use an N period SMA to start their EMA. I can’t see any mathematical rationale for doing that. But it’s common so it’s worth mentioning. It’s also worth mentioning that not everyone uses the same number of bars for the initial SMA!
How important is that? Well, it depends how much data you are looking at. The earlier entries often show more differences than the later periods. If we are looking at two different charting packages, and we look at today’s value, we would expect fewer differences than if we were looking at the earliest value printed on the chart.
That brings up another difference. How much data are you looking at? Like all indicators based on EMAs, adding more historical data will change the value for today! How much of a difference? It depends. If the chart is pretty boring, older values quickly become less and less interesting. But if you go back a little further, and suddenly one day the price dropped by 50%, then suddenly today’s value will have a noticeable change.
Many of these issues are common to a number of different indicators. But I’ve been looking at a lot of different definitions recently, and I’ve found other discrepancies in the ADX formula. This one comes from a forex site. Some people say that the ADX started with forex traders, so maybe we should take a look. Average Directional Index (ADX) | Forex Indicators Guide There’s another subtle difference in here. Their formula for the ADX is certainly shorter than others. Look at their definition of PDI and MDI. Most people say that at least one of these has to be 0. But not their definition. Is this a typo? An improvement done on purpose? Hard to say.
What’s the moral of the story? These things are not exact. Different people compute these formulas differently. And the underlying data is not always correct or the same for everyone. (See Configuration Window: Bad Market Data) If you’re looking for something simple and precise, go back to bingo. Stock trading is challenging. We’re here to help, but you’re not always going to get a simple, perfect answer. You have to do the best you can with the data available.