diff --git a/backtrader/analyzer.py b/backtrader/analyzer.py index 881302683..4de263e87 100644 --- a/backtrader/analyzer.py +++ b/backtrader/analyzer.py @@ -397,7 +397,7 @@ def _get_subday_cmpkey(self, dt): point = point * 1e6 + dt.microsecond # Apply compression to update point position (comp 5 -> 200 // 5) - point = point // self.compression + point //= self.compression # Move to next boundary point += 1 diff --git a/backtrader/analyzers/drawdown.py b/backtrader/analyzers/drawdown.py index 62e1b2623..34bed9daf 100644 --- a/backtrader/analyzers/drawdown.py +++ b/backtrader/analyzers/drawdown.py @@ -106,7 +106,7 @@ def next(self): r.max.moneydown = max(r.max.moneydown, moneydown) r.max.drawdown = maxdrawdown = max(r.max.drawdown, drawdown) - r.len = r.len + 1 if drawdown else 0 + r.len += 1 if drawdown else 0 r.max.len = max(r.max.len, r.len) diff --git a/backtrader/indicators/psar.py b/backtrader/indicators/psar.py index 8dc41b875..89e21536d 100644 --- a/backtrader/indicators/psar.py +++ b/backtrader/indicators/psar.py @@ -151,7 +151,7 @@ def next(self): ep = lo af = min(af + self.p.af, self.p.afmax) - sar = sar + af * (ep - sar) # calculate the sar for tomorrow + sar += af * (ep - sar) # calculate the sar for tomorrow # make sure sar doesn't go into hi/lows if tr: # long trade diff --git a/backtrader/resamplerfilter.py b/backtrader/resamplerfilter.py index 010a6b6bc..5b7648a13 100644 --- a/backtrader/resamplerfilter.py +++ b/backtrader/resamplerfilter.py @@ -373,7 +373,7 @@ def _calcadjtime(self, greater=False): # Apply compression to update the point position (comp 5 -> 200 // 5) # point = (point // self.p.compression) - point = point // self.p.compression + point //= self.p.compression # If rightedge (end of boundary is activated) add it unless recursing point += self.p.rightedge