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

problem with ATR and MACD indicators #78

Closed
rdft4e opened this issue Jan 4, 2021 · 2 comments
Closed

problem with ATR and MACD indicators #78

rdft4e opened this issue Jan 4, 2021 · 2 comments

Comments

@rdft4e
Copy link

rdft4e commented Jan 4, 2021

Hi! thank you for vectorbt!

According to the documentation, the MACD defaults are defined as: def run(close, fast_window=26, slow_window=12,...
is it really fast_window=12, slow_window=26 ??

Also, I had hard times trying to find why the ATR(14) from vectorbt does not match with calculated from tradingview.
Do you mind to check the code ? I check and I see it ok. The strange thing is that ATR(28) (and using ewm = true) here in vectorbt matchs ok the ATR(14) from tradingview.

Thank you again!!

@polakowo
Copy link
Owner

polakowo commented Jan 4, 2021

You're right, defaults for MACD should be reversed. Regarding ATR, there are different smoothing methods (see ATR Calculation Methods and Formulas) - vectorbt uses SMA and EMA, while ta, talib and probably TradingView use Wilder’s method. There is no right or wrong method. If you want to use Wilder, you can use vbt.IndicatorFactory.from_talib('ATR').

@rdft4e
Copy link
Author

rdft4e commented Jan 4, 2021

Thank you! It is exactly how you say and the information in the link. The "translation" to TradingView would be the window times 2n-1. In this case ATR(27) from vectorbt is mostly equivalent to ATR(14) from Wilder's, talib, tradingview.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants