vn.py量化社区
By Traders, For Traders.
Member
avatar
加入于:
帖子: 5
声望: 0

下单代码如下,请问哪里错了呢?谢谢!
self.boll_up, self.boll_down = am.boll(self.boll_window, self.boll_dev)
self.cci_value = am.cci(self.cci_window)
self.atr_value = am.atr(self.atr_window)

    if self.pos == 0:
        self.intra_trade_high = bar.high_price
        self.intra_trade_low = bar.low_price

        if self.cci_value > 0:
            self.buy(self.boll_up, self.fixed_size, True)
        elif self.cci_value < 0:
            self.short(self.boll_down, self.fixed_size, True)

    elif self.pos > 0:
        self.intra_trade_high = max(self.intra_trade_high, bar.high_price)
        self.intra_trade_low = bar.low_price

        self.long_stop = self.intra_trade_high - self.atr_value * self.sl_multiplier
        self.sell(self.long_stop, abs(self.pos), True)

    elif self.pos < 0:
        self.intra_trade_high = bar.high_price
        self.intra_trade_low = min(self.intra_trade_low, bar.low_price)

        self.short_stop = self.intra_trade_low + self.atr_value * self.sl_multiplier
        self.cover(self.short_stop, abs(self.pos), True)
Administrator
avatar
加入于:
帖子: 4130
声望: 230

请检查下你的buy/sell/short/cover里面,第一个参数价格和第二个参数数量,是否有传入0或者字符串的情况

© 2015-2019 上海韦纳软件科技有限公司
备案服务号:沪ICP备18006526号-3