A trading system based on ADX and DI technical indicators
Script examples. A trading system based on ADX and DI technical indicators
Wikipedia.org/ Average directional movement index
This strategy based on ADX and DI technical indicators has been presented by J. Welles Wilder in his “New Concepts in Technical Trading Systems” book published in 1978. Wilder thinks that growing and high values of ADX show strong trend in the market and falling and low values indicate no trend at all.
We will try to build the strategy offered in Wikipedia.
For long positions
Buy if +DI > -DI and ADX is growing.
Close a position if +DI < -DI and ADX is falling down.
For short positions:
Open a short positon if +DI < -DI anf ADX is growing.
Close a short position if +DI > -DI and ADX is falling down.
The strategy is quite simple if we understand what is to grow and what is to fall down. If we have a look at the indicator chart, we can say that the indicator is growing here and here it’s values are falling down. But we can see it only using offline data and we don’t know what to expect in future. There can be several ways how to detect that the indicator is growing. For example, if the previous value of the ADX indicator is less than the current one, it obviously means that the indicator value has increased and it’s growing.We can write it down as ADX[i-1] < ADX. Or, for example, ADX[i-5]<ADX means that the current value is bigger than 5 bars ago and the indicator value has become bigger. But it doesn’t mean that three bars ago the indicator value was less than the current value. So our formula can look like this - ADX[i-5]<ADX[i-4] && ADX[i-4]<ADX[i-3] && ADX[i-3]<ADX[i-2] && ADX[i-2]<ADX[i-1] && ADX[i-1]<ADX. We see consequent growth in each and every bar of five. It doesn’t happen too often. Here we need to see if this condition can mean the end of growth. So in any case we should whether optimize the constant ADX > ADX[i-Constant] or just define by eye that the indicator value is growing. We can use an average ADX value to define the status of the indicator. SMAadx < ADX. There are many other ways as well, for example ADX > ADX[i-speed].
It means I use an indicator instead of a fixed bar. But there’s something to pay attention to here. In “Formula” and “Boolean Formula” blocks there’s a parameter “Start with”. We should set a bigger value here in this parameter than a possible value of the indicator. For example, if we optimize our strategy we can select a wide range of values for a constant, from 1 to 1000, and in “Formula” block we need to choose 1001 as a parameter value. Probably we need to smooth DI before we create a position opening condition or, as Wilder said, we need to consider an ADX value… if the indicator value is small, we cannot expect any trend in the market… there can be many other variants as well.
This strategy is just an example for TSLab learners. Good luck!
ADX.tscript Download the file. Click Lab in TSLab main menu, then choose Script manager. Click the Load from file button.
Last updated