def on_tick(self, serial): StrategyBase.on_tick(self, serial) if (self.run_flag == False): return if (self.hh ==0 or self.ll==0): return if (self.ask_price <=self.ll and self.position != 1): self.set_position(1) if (self.bid_price>=self.hh and self.position != -1): self.set_position(-1)
def on_tick(self, serial): if (self.run_flag == False or self.key_price == 0): return StrategyBase.on_tick(self, serial) if (self.inited == False): self.init_data() self.inited = True if (abs(self.ask_price - self.key_price) > 30): return #防止一启动就达到关键位置(参数未更新) if (self.init_price_state == 1 and abs(self.ask_price - self.key_price + 15) < 11): self.mark_bar = self.get_current_minute_bar() elif (self.init_price_state == -1 and abs(self.ask_price - self.key_price) < 11): self.mark_bar = self.get_current_minute_bar()
def on_tick(self, serial): StrategyBase.on_tick(self, serial)
def on_tick(self, serial): if (self.run_flag == False): return StrategyBase.on_tick(self, serial)