You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: