TA-Lib / ta-lib-python

Python wrapper for TA-Lib (http://ta-lib.org/).
http://ta-lib.github.io/ta-lib-python
Other
9.49k stars 1.74k forks source link

TA_EMA function failed with error code 2: Bad Parameter (TA_BAD_PARAM) #502

Closed mert-donmez closed 2 years ago

mert-donmez commented 2 years ago

I calculate value_ by giving value to the length, but when I give the 1, I get the error in the title

df[value_]=ta.EMA(df , length)

There is no problem when I give a value greater than 2

poursaeid commented 1 year ago

Hi , I have the same problem. did you find any solution for this ?

mert-donmez commented 9 months ago

Hi , I have the same problem. did you find any solution for this ?

Sorry for the late response. If you continue to give the Length value as 1, you will continue to receive an error. However, using df['close'] instead of trying to give the Length value as 1 will solve the problem. The EMA1 value will already be equal to the last closing price.

mrjbq7 commented 9 months ago

I don't think you want to pass length, you want to pass the period for the EMA calculation, and you probably don't just want the defaults to 30, I think.