def macd_rule(df):
try: df = MACD(df)
except: return False
input_1 = 0.2
input_2 = -0.8
input_3 = 22 * 3
index = -1
df['macd_dif_1'] = df['macd_dif'].shift(1)
df['macd_dea_1'] = df['macd_dea'].shift(1)
return (abs(df['macd_dea'][index]) < input_1) & \
(abs(df['macd_dif'][index]) < input_1) & \
(df['macd_dif'][-input_3:].min() < input_2) & \
(df['macd_dif'][index] > df['macd_dea'][index]) & \
((df['macd_dea_1'][index] > df['macd_dif_1'][index]) | (abs(df['macd_dea_1'][index] - df['macd_dif_1'][index]) < 0.007))
Filter_Stock_CHN_1.py 文件源码
python
阅读 18
收藏 0
点赞 0
评论 0
评论列表
文章目录