Learn about ADX (Average Directional Index) and how you can use it in your trading strategy.
The Average Directional Index (ADX) is a popular technical indicator used by traders to gauge the strength of a trend, regardless of its direction (upward or downward). It was developed by J. Welles Wilder in the 1970s and is often used in conjunction with two other indicators, the Positive Directional Indicator (+DI) and the Negative Directional Indicator (-DI), to determine the direction of the trend.
If you’re considering entering a trade based on another indicator or analysis method, you can use the ADX to confirm the strength of the trend. If ADX is rising and above 20, it indicates a strengthening trend.
If ADX is below 20, it can be a sign that the market is range-bound or consolidating, which may be a signal to avoid trend-following strategies.
Using the crossover of these indicators can help traders identify potential entry or exit points. For example, if +DI crosses above -DI and ADX is rising, this might be a bullish signal.
Many traders use ADX in combination with other technical indicators like moving averages, MACD, or RSI to get more comprehensive insights.
Use ADX in your trading strategy to establish current market conditions compared to past data. You can use this to set up conditions for other trading logic.
For example, if the market is “Sideways Up” you may want to trade a smaller position size compared to if it’s “Upward” in this case, or even a completely different strategy.
In this case, we are calling a “sideways” market anything below 40 for ADX and then using +DI and -DI to establish upward or downward movement.
# Calculate ADX, +DI and -DI
adx = talib.ADX(df['high'], df['low'],
df['close'], timeperiod=14)
plus_di = talib.PLUS_DI(
df['high'], df['low'], df['close'], timeperiod=14)
minus_di = talib.MINUS_DI(
df['high'], df['low'], df['close'], timeperiod=14)
# Determine the market condition
last_adx = adx.iloc[-1]
last_plus_di = plus_di.iloc[-1]
last_minus_di = minus_di.iloc[-1]
if (last_adx < 40 and last_plus_di > last_minus_di):
market_condition = 'Sideways Up'
elif (last_adx < 40 and last_plus_di < last_minus_di):
market_condition = 'Sideways Down'
elif (last_adx >= 40 and last_plus_di > last_minus_di):
market_condition = 'Upward'
elif (last_adx >= 40 and last_plus_di < last_minus_di):
market_condition = 'Downward'
# Strategies based on market condition
if market_condition == 'Sideways Up' or market_condition == 'Sideways Down':
### Your trading strategy...
elif market_condition == 'Upward' or market_condition == 'Downward':
### Different trading strategy...
If you're serious about creating a trading bot, consider accessing our tutorials and downloads to learn how to build your own trading bot, platorm or data viewer.
Sign up for a membership today for only $9
Get Full AccessTopics discussed in this article:
Trading StrategiesAverage Directional Index (ADX)Nick DeRose is the owner of ManicDream. His mission is to teach others about automated trading, python, market trends, and host a platform where people can share their experiences and learn from other traders. His holdings include BTC, ETH, XRP, LINK, DOGE, ADA, and SHIB.