I was trying to call an external python library 'talib' and one of its functions is giving me an error, 'Bad Parameter' - I thought I was passing in all arguments correctly, but perhaps not?
I think the problem might be in the function definition, but I'm not sure because I'm unfamiliar with this python syntax. The function definition shows brackets in the input.
I'm not sure if this is an error with the imported package and its function ADOSC, else I don't know how to use the function given this syntax:
The function definition is as follows (note ADOSC function inputs):
Help on function ADOSC in module talib._ta_lib:
ADOSC(...)
ADOSC(high, low, close, volume[, fastperiod=?, slowperiod=?])
Chaikin A/D Oscillator (Volume Indicators)
Inputs:
prices: ['high', 'low', 'close', 'volume']
Parameters:
fastperiod: 3
slowperiod: 10
Outputs:
real
I'm using the function like this, which should simply return the dataframe columns I'm after (similar loop is working with other functions):
for d in [1, 2, 3, 4, 5]:
df['ADOSC'+str(d)] = talib.ADOSC(df.High, df.Low, df.Close, df.Vol, fastperiod=d, slowperiod=10)
But this is the end of the error message that I get back (seems like a broken function definition as mentioned above, no?)
_func.pxi in talib._ta_lib.ADOSC()
_common.pxi in talib._ta_lib._ta_check_success()
Exception: TA_ADOSC function failed with error code 2: Bad Parameter (TA_BAD_PARAM)