1. Learn
  2. /
  3. Courses
  4. /
  5. Financial Trading in Python

Exercise

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.

Instructions 1/2

undefined XP
    1
    2
  • Calculate the 14-day (by default) ADX, and save it in a column called ADX.
  • Create two subplots named ax1 and ax2.
  • Plot the Close price in the subplot ax1 on top and ADX in the subplot ax2 at the bottom.