Get startedGet started for free

Visualize the ADX

The ADX can quantify the strength of a trend, but does not suggest the bullish or bearish trend direction. Typically an ADX value above 25 indicates that a trending market is present. To better understand it, you will calculate the ADX and plot it along with the price data.

As in the previous exercise, you will use historical daily price data of the Tesla stock, which has been loaded in as stock_data. Also, talib has been imported for you, and matplotlib.pyplot has been imported as plt.

This exercise is part of the course

Financial Trading in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Calculate ADX
stock_data['ADX'] = ____(stock_data['____'], stock_data['____'], stock_data['____'])

# Create subplots
fig, (ax1, ax2) = ____(2)

# Plot ADX with the price
ax1.set_ylabel('Price')
____(stock_data['____'])
ax2.set_ylabel('ADX')
____(stock_data['____'], color='red')

ax1.set_title('Price and ADX')
plt.show()
Edit and Run Code