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

Indicator on indicator gives different values from bt.indicators #14

Open
slangda opened this issue Apr 1, 2021 · 2 comments
Open

Indicator on indicator gives different values from bt.indicators #14

slangda opened this issue Apr 1, 2021 · 2 comments

Comments

@slangda
Copy link

slangda commented Apr 1, 2021

As I have mentioned on the community forum:
https://community.backtrader.com/topic/3687/bta-lib-and-bt-indicators-deliver-different-values-when-using-indicator-on-indicator

The bta-lib indicator on indicator gives different results than when using this in backtrader internally.

The problem surfaces when you use RSI on ATR for example.

atr14 = ATR(High, Low, Close, period=14)

This will return a pandas dataframe containing NaN values.

When you feed this to the next indicator, this results in different values from Backtrader:

rsi_atr = RSI(atr14, period=7)

In order to come up with the same results, one should implement the dataframe without the NaN values.

rsi_atr = RSI(atr14.dropna(), period=7)

I am uncertain considering the setup of the bta-lib framework if the dataframe returned from the functions should be stripped of NaN values (losing the index compatibility, don't think that is good) or if bta-lib functions should drop NaN values before computations.

However, in the Backtrader implementation this is done correctly. I feel bta-lib should deliver exactly the same results.

@slangda
Copy link
Author

slangda commented Apr 1, 2021

Oh and thank you for this library. I was writing my own implementations and have tried TA-Lib, but this is the best library around IMHO.

@adrianog
Copy link

but unmaintained?

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