Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Please help me tune ADX to match TD Ameritrade values

I am trying to get ADX values similar to what I see with TD Ameritrade app for LABD, but I get lots on nans and most numbers are off.
Probably something wrong with parameters?
TD Ameritrade parameters for ADX are standart: 14 length, average type Wilders.

Thank you!

4 responses

Tomila,

LABD is not activly traded instrument.
It may not be traded for 15-20 min.
The only way to get '1 m' ADX calculated use .bfill() or .ffill().

Try this:

"""
ADX Test  
"""
import talib

def initialize(context):  
    context.labd = sid(49072)

def handle_data(context, data):  
    period = 14  
    bars = period*2 +1

    H = data.history(context.labd, 'high', bars, '1m').ffill()  
    L = data.history(context.labd, 'low', bars, '1m').ffill()  
    C = data.history(context.labd, 'price', bars, '1m').ffill()

    adx = talib.ADX(H, L, C, period)

    labd_adx = adx[-1]  
    print labd_adx  

Thank you, Vladimir. I tried and nans are gone.
But values are really off.
For example, I can match ADX from TD Ameritrade charts on 03/13/2017 at 10:30
TD ADX was 16
talib ADX shows 37...

I played with bars... the closest value I can get is when bars = 100.

I am getting 16.3695507727

But I feel like I am with a crystal ball here...

I need also ADX with minute frame.
Some news?
Thanks.