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)
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)
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)
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?
I was going through the documentation and think I might have stumbled upon some incomplete code on the following link:
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import argparse
import datetime
import os.path
import time
import sys
import backtrader as bt
import backtrader.feeds as btfeeds
import backtrader.indicators as btind
class MyStrategy(bt.Strategy):
params = (('smaperiod', 15),)
def log(self, txt, dt=None):
''' Logging function fot this strategy'''
dt = dt or self.data.datetime[0]
if isinstance(dt, float):
dt = bt.num2date(dt)
print('%s, %s' % (dt.isoformat(), txt))
def __init__(self):