I wrote a pretty simple piece of code, using TA-lib, implementing the ADX indicator.
import talib as ta
import numpy as np
import pandas as pd
def initialize(context):
context.stock = sid(8554)
def handle_data(context,data):
highs = data.history(context.stock, 'high', 200, '1d')
lows = data.history(context.stock, 'low', 200, '1d')
close = data.history(context.stock, 'close', 200, '1d')
ADX = ta.ADX(highs, lows, close, timeperiod=14)
mDI = ta.MINUS_DI(highs, lows, close, timeperiod=14)
pDI = ta.PLUS_DI(highs, lows, close, timeperiod=14)
I was wondering if anyone has found a way to implement the ADX indicator into pipeline, as I have heard TA-lib isn't efficient when being calculated with a wide range of securities.