Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difference in EMA values between pandas-ta and tradingview #629

Open
thecpshah opened this issue Dec 9, 2022 · 7 comments
Open

Difference in EMA values between pandas-ta and tradingview #629

thecpshah opened this issue Dec 9, 2022 · 7 comments
Labels
bug Something isn't working info Informational

Comments

@thecpshah
Copy link

thecpshah commented Dec 9, 2022

Which version are you running? The lastest version is on Github. Pip is for major releases.
0.3.14b0

Do you have TA Lib also installed in your environment?
Yes

Have you tried the development version? Did it resolve the issue?
No

Describe the bug
I am trying to calculate 200 days ema but the ema from ta is way off.

To Reproduce

import yfinance as yf
import pandas_ta as ta

x = yf.download('ABB.NS', start = "2021-12-08", progress = False)['Close']

ema= ta.ema(x, 200)[-1]

Expected behavior
expected 200 days ema = 2720.93

Additional context
20 days and 50 days ema are matching with TradingView but not 100 and 200 days.

I tried to use help(ta.ema) but not sure which number to use for the offset argument

@thecpshah thecpshah added the bug Something isn't working label Dec 9, 2022
@twopirllc twopirllc removed their assignment Dec 13, 2022
@twopirllc twopirllc added help wanted Extra attention is needed info Informational and removed help wanted Extra attention is needed labels Dec 13, 2022
@twopirllc
Copy link
Owner

Hello @thecpshah,

First, offset only shifts the result.

Second, it is not really good to compare a TV datasource (apples) with Yahoo Finance (oranges). Sure, it's possible they maybe equal at times but not a guarantee.

Third since you have TA Lib installed, ta.ema() uses TA Lib for it's calculation which isn't exactly the same at TV. If you want to disable TA Lib for ema, do: ta.ema(x, 200, talib=False) or possibly ta.ema(x, 200, sma=False, talib=False).

Lastly, I recommend updating to the development branch.

Hope this helps!

Kind Regards,
KJ

@thecpshah
Copy link
Author

Thanks for reply. Disabling TA lib, gives me same result as Pandas' EWM.

@thecpshah
Copy link
Author

Also, the difference occurs for longer MAs. The numbers are very close for 20 or 50 days exponential MAs.

@baotang2118
Copy link

baotang2118 commented Jan 28, 2023

Hello @twopirllc

Thank for you reply, I think it's time to create new release, it's about more than 1 year since the last release on 2021. Many bugs had been fixed, many documents had been updated.

Hello @thecpshah,

First, offset only shifts the result.

Second, it is not really good to compare a TV datasource (apples) with Yahoo Finance (oranges). Sure, it's possible they maybe equal at times but not a guarantee.

Third since you have TA Lib installed, ta.ema() uses TA Lib for it's calculation which isn't exactly the same at TV. If you want to disable TA Lib for ema, do: ta.ema(x, 200, talib=False) or possibly ta.ema(x, 200, sma=False, talib=False).

Lastly, I recommend updating to the development branch.

Hope this helps!

Kind Regards, KJ

@twopirllc
Copy link
Owner

Hi @baotang2118

Thank for you reply, I think it's time to create new release, it's about more than 1 year since the last release on 2021. Many bugs had been fixed, many documents had been updated.

No worries. Apologies for the slow response.

I have been intending to finish the remaining TA Lib ht_ indicators before making a new release. Unfortunately since the last release, my time has been more sparse than I expected. 😑
Considering my current availability, I will clear up outstanding PRs and abandon the plan to add the ht_ indicators for the next release. 😞

KJ

@jjvvhh2
Copy link

jjvvhh2 commented Feb 24, 2023

Hi @twopirllc, just to know do you have an estimated date for the next release? can i still use the current library then will only have to replace by the new one once released?
Thanks,

@twopirllc
Copy link
Owner

@jjvvhh2,

do you have an estimated date for the next release?

At my current rate, I estimate a couple of months at best. 🤷🏼‍♂️ Sadly my free time has been limited. 😑

can i still use the current library then will only have to replace by the new one once released?

You can use either, however I recommend the new one when it's updated. It fixes many bugs, improved speed & documentation. You can read more here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working info Informational
Projects
None yet
Development

No branches or pull requests

4 participants