```
# 跳空低开止损
def tkdk(context):
for stock in context.portfolio.positions:
bars = get_bars(stock, count=6, unit='1d', include_now=True, fields=['close', 'low', 'high'])
#
ma5 = bars['close'][-5:].mean() # 今天的ma5
ma5_r1 = bars['close'][-6:-1].mean() # 昨天的ma5
llv5_r1 = bars['low'][-6:-1].min() # 过去5天的最低价
last_low = bars['low'][-2] # 昨日最低
now_high = bars['high'][-1] # 今天最高
now_close = bars['close'][-1] # 当前价位
#
if now_close < ma5 < ma5_r1 and (now_close / now_high < 0.975 or now_close < llv5_r1) and now_high < = last_low:
log.info('跳空低开止损:%s, 当前价:%.3f, 今日最高: %.3f, 今日ma5: %.3f, 昨最低价: %.3f, 昨日ma5: %.3f, 昨日LLV5: %.3f' %
(stock, now_close, now_high, ma5, last_low, ma5_r1, llv5_r1))
order_target(stock, 0)
```
跳空低开这段也好理解,就是如此苛刻的条件,真的有这样的情形存在么?
2019-12-22