From c2a1a8be0c59efe67ef6625f57ab6d1864a4b7a6 Mon Sep 17 00:00:00 2001 From: chenxy123 Date: Thu, 28 Jul 2016 22:16:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9ATR-RSI=E6=BC=94=E7=A4=BA?= =?UTF-8?q?=E7=AD=96=E7=95=A5=E7=9A=84=E4=BB=93=E4=BD=8D=E4=BF=A1=E5=8F=B7?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E9=80=BB=E8=BE=91=EF=BC=8C=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E4=BB=93=E4=BD=8D=E8=B6=85=E8=BF=871?= =?UTF-8?q?=E6=97=B6=E7=AD=96=E7=95=A5=E5=A4=B1=E5=8E=BB=E5=8F=8D=E5=BA=94?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vn.trader/ctaAlgo/strategyAtrRsi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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