title: How to find Average directional movement for stocks using Pandas?
body: <p>I have a dataframe of OHLCV data. I would like to know if anyone knows any tutorial or any way of finding ADX(Average directional movement ) using pandas?</p>
  <pre><code>import pandas as pd 
  import yfinance as yf
  import matplotlib.pyplot as plt
  import datetime as dt 
  import  numpy as nm 
  
  
  start=dt.datetime.today()-dt.timedelta(59)
  end=dt.datetime.today()
  
  df=pd.DataFrame(yf.download(&quot;MSFT&quot;, start=start, end=end))
  </code></pre>
  <p>The average directional index, or ADX, is the primary technical indicator among the five indicators that make up a technical trading system developed by J. Welles Wilder, Jr. and is calculated using the other indicators that make up the trading system. The ADX is primarily used as an indicator of momentum, or trend strength, but the total ADX system is also used as a directional indicator.<br />
  Directional movement is calculated by comparing the difference between two consecutive lows with the difference between their respective highs.</p>
  <p>For the excel calculation of ADX this is a really good video:</p>
  <p><a href="https://www.youtube.com/watch?v=LKDJQLrXedg&amp;t=387s" rel="nofollow noreferrer">https://www.youtube.com/watch?v=LKDJQLrXedg&amp;t=387s</a></p>