Skip to content

Commit f819e5d

Browse files
authored
Update backtesting/lib.py
1 parent 4312281 commit f819e5d

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

backtesting/lib.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -441,13 +441,7 @@ def set_trailing_sl(self, n_atr: float = 6):
441441

442442
def next(self):
443443
super().next()
444-
"""
445-
self.data in init() is different from self.data in next(). self.data in init() has all the data.
446-
while the one in next() gets accumulated data over iterations. i.e. 5 iterations -> 5 data. n iteration -> n data.
447-
so doing self.data.Close[-1] in next() gets you the last record.
448-
but the same is not true for self.__atr, because self.__atr always has fully computed set from init(),
449-
so we need to use absolute index while accessing atr value from self.__atr.
450-
"""
444+
# Can't use index=-1 because self.__atr is not an Indicator type
451445
index = len(self.data)-1
452446
for trade in self.trades:
453447
if trade.is_long:

0 commit comments

Comments
 (0)