Calculating ADX in python

Hello there:



As many of you probably know, there is a technical indicator library called ta-lib  in python…  Is there any function in this library that can help me calculate the ADX for data given in a dataframe??



Mainly, I am trying to  fetch historical data using  " request_historical_data " method in ibridgepy… now, this returns a dataframe… is it possible to add a column to that dataframe so that this column contains the ADX indicator using Ta-lib??



Thanks

 

Hi Ghery



Yes, it is possible to add a column in the dataframe that you get from the "request_historical_data" method. 



To calculate ADX you can use the "ADX" method from the TA-Lib.

df['ADX'] = tb.ADX(high, low, close, timeperiod=14)

TA-Lib library also has "PLUS_DI" and "MINUS_DI" methods to calculate +DMI and -DMI. 



You can go to this link to see some examples of how to use ADX, PLUS_DI, and MINUS_DI methods.



Here are a few pages you can refer to know more about ADX and how to use it.

ADX: The Trend Strength Indicator

https://blog.quantinsti.com/adx-indicator-python/



I hope this helps.

Thanks





 

Thanks a lot, that was very Helpfull…  but where can I find  more documentation on Talib?

To see the full documentation of TA-Lib you can go to this page.