mods to macd to match tradingview
See original GitHub issueWhich version are you running? The lastest version is on Github. Pip is for major releases.
import pandas_ta as ta
print(ta.version)
0.2.23b0
Upgrade.
$ pip install -U git+https://github.com/twopirllc/pandas-ta
Describe the bug A clear and concise description of what the bug is. macd wasn’t matching results from tradingview I made a mod to each of 2 files ema.py line 20 sma_nth = close[0:length].mean() #ensure desired treatment of nan treatment
macd.py line 23 signalma = ema(close=macd.loc[macd.first_valid_index():,], length=signal) # do not process initial nan values
if you agree with these changes, it’d be great to incorporate them into the next release Thanks
To Reproduce Provide sample code.
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.
Thanks for using Pandas TA!
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
Hi KJ, Thanks for your swift response. I tested with company symbol U for unity, because it is a new ipo (not so much data)
Perhaps i should use some kwargs to achieve the matching result, but i’m not too familiar with kwargs at this time.
i will look at providing the correlation as you like, tomorrow
I apologize if I appear defensive. But I have gotten and will continue to get Issues along the lines of “Indicator Yabb-Do is incorrect with TradingView/Webull …” and their level of proof is similar to the following or nothing at all.
🤷♂️
Likewise. Nowhere in this Issue have I stated that I am against collaboration. In fact, I prefer it so that I can continue adding new features and indicators.
Great! Fork the repository, edit, and make a Pull Request so you get collaboration credit and everyone benefits.
It’s great when there is 1-1 correspondence of indicator calculations irregardless of the underlying language (C, Python, Pinescript, …) with the same data set. Sadly that is not always the case. Though it is imperative to get the core indicators such as sma, ema, et al near 1-1. However for the majority of non-core indicators, there can be endless minute variations across trading platforms and even harder to correlate if there is no accompanying source or it is proprietary.
TradingView (TV) is widely used, as you know, so I doubt their code is “incorrect”. I have and do correlation tests with TV, as I previously linked, when necessary or when replicating someone’s request for an indicator that is publicly available.
Regards, KJ