For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
bta-lib and bt.indicators deliver different values when using indicator on indicator
-
I am thankfully using bta-lib in computing indicators the right way and to make sure they are equivalent to what is being used in Backtrader. When using single indicators like RSI, ATR, MACD, the values are exactly the same in bta-lib and Backtrader, as expected.
However, when I use an indicator on indicator approach, like a RSI on ATR, there is a rather large discrepancy between values. The source values, in this case ATR, are similar.
The Backtrader indicator (RSI on ATR) seems to deliver the correct value in my opinion.
Any suggestions?
-
Found the culprit.
When examing the ATR dataframe returned from the bta-lib ATR function it contains NaN.
After removing the NaN values from the dataframe I got the same results.RSI(atr_df.dropna(), period=7)