diff --git a/vn.trader/ctaAlgo/strategyAtrRsi.py b/vn.trader/ctaAlgo/strategyAtrRsi.py index 4832d8fe..70029941 100644 --- a/vn.trader/ctaAlgo/strategyAtrRsi.py +++ b/vn.trader/ctaAlgo/strategyAtrRsi.py @@ -204,7 +204,7 @@ class AtrRsiStrategy(CtaTemplate): self.short(bar.close-5, 1) # 持有多头仓位 - elif self.pos == 1: + elif self.pos > 0: # 计算多头持有期内的最高价,以及重置最低价 self.intraTradeHigh = max(self.intraTradeHigh, bar.high) self.intraTradeLow = bar.low @@ -215,7 +215,7 @@ class AtrRsiStrategy(CtaTemplate): self.orderList.append(orderID) # 持有空头仓位 - elif self.pos == -1: + elif self.pos < 0: self.intraTradeLow = min(self.intraTradeLow, bar.low) self.intraTradeHigh = bar.high