question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mods to macd to match tradingview

See original GitHub issue

Which 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:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
martin0commented, Oct 13, 2020

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) image

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

0reactions
twopirllccommented, Oct 15, 2020

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.

datetime | Yabba_10 | Do_15
8/22/2020 10:00 | 23.2039 | 20.5802
8/22/2020 11:00 | 54.0628 | 32.7028
8/22/2020 12:00 | 78.2172 | 51.9909
8/22/2020 13:00 | 95.7515 | 76.1622

# But very off from charts TradingView/Webull:
8/22/2020 10:00 | 14.46 | 21.09
8/22/2020 11:00 | 14.32 | 14.64
8/22/2020 12:00 | 45.65 | 23.81
8/22/2020 13:00 | 78.22 | 46.07

🤷‍♂️

I would prefer if we could collaborate. Please let me know if you would like this.

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.

I have also put in “free” time to make sure the values match TradingView (TV), and shared the corrections I made. I have also adjusted rma and rsi, but unless you’re interested, I don’t see the point in sharing the details.

Great! Fork the repository, edit, and make a Pull Request so you get collaboration credit and everyone benefits.

I think what’s interesting is what the definition of “correct” is. Perhaps TradingView is wrong…?

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

MACD-X Overlay, More Than MACD by DGT - TradingView
In its simples form, MACD-X implements variety of different calculation techniques applied to obtain MACD Line. Different calculation techniques ...
Read more >
Setting Up Your Trading View Mod MACD System Charts
A break down of tradingview.com's charting platform, specifically using Jim Brown's Mod MACD trading system. Learn to modify the color ...
Read more >
Unable to match conditions for TradingView plotshape in Pine ...
The MACD LINE (Green) is above the SIGNAL LINE (Red) · The 9 EMA LINE (Green) is above the 18 EMA LINE (Red)...
Read more >
Is 'qqe mod' a good indicator in TradingView? - Quora
MACD with Fast, Slow and signal of 12, 26 and 9 respectively. BUY SIGNAL: The E5 line should cross the other two lines...
Read more >
Creating the MACD Oscillator in TradingView — The Full Guide.
The MACD is a famous technical oscillator that is composed of the difference between two exponential moving averages which are used in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found