bukosabino / ta

Technical Analysis Library using Pandas and Numpy
https://technical-analysis-library-in-python.readthedocs.io/en/latest/
MIT License
4.33k stars 915 forks source link

MACD errors #300

Open sanbikinosaru opened 2 years ago

sanbikinosaru commented 2 years ago

Version 0.10.1 ta.trend.MACD(df.close, window_slow = 26, window_fast = 12, window_sign = 9) is outputing <ta.trend.MACD object at 0x000001C2823C7280>

ta.trend.macd(df.close, window_slow = 26, window_fast = 12, window_sign = 9) is outputing TypeError: macd() got an unexpected keyword argument 'window_sign'

ta.trend.macd(df.close, window_slow = 26, window_fast = 12) output ok

barsv commented 5 months ago

AFAIU, it's not a bug, because ta.trend.macd(df.close, window_slow = 26, window_fast = 12) is a shorthand for ta.trend.MACD(df.close, window_slow = 26, window_fast = 12, window_sign = 9).macd()

you don't need a signal line to calculate .macd() hence parameter window_sign is not needed for it. it's needed only for ta.trend.macd_signal(...) and ta.trend.macd_diff().