调整一下买入和卖出的指标

This commit is contained in:
lzybetter
2026-07-23 17:18:12 +08:00
parent 93c19ce753
commit 30219cfbdc
2 changed files with 30 additions and 3 deletions
+28 -3
View File
@@ -71,13 +71,38 @@ class TelegramQuantStateMachine(QuantStateMachine):
if self.current_state in ["STATE_1_OSCILLATION", "STATE_1_OSCILLATION_SQUEEZE"]: if self.current_state in ["STATE_1_OSCILLATION", "STATE_1_OSCILLATION_SQUEEZE"]:
if self.current_state == "STATE_1_OSCILLATION_SQUEEZE": if self.current_state == "STATE_1_OSCILLATION_SQUEEZE":
msg += "⚠️ *[变盘警告]*:弹簧已压紧,随时大突破,做T手速要快!\n" msg += "⚠️ *[变盘警告]*:弹簧已压紧,随时大突破,做T手速要快!\n"
if f['percent_b'] >= 1.0 or f['min_bias'] > 0.035:
## 盘整阶段,三个指标会触发卖出提醒
## kdj死叉,且cci在下降中,且收盘价在5日均线下
## cci顶背离,且k线在d线之下,且收盘价在5日均线下
## cci从100以上下降到100以下,且k线在d线之下,且收盘价在5日均线下
if ((f['K'] < f['D'] and f['prev_K'] > f['prev_D']) ## kdj死叉
and (f['cci'] < f['prev_cci']) ## cci在下降中
and (f['close'] < f['ma5'])): ## 收盘价在5日均线下
msg += f"🟢 *【建议高抛】*:当前处于震荡高位(价格:{f['close']}),建议尾盘或明日开盘*手动卖出网格仓*!" msg += f"🟢 *【建议高抛】*:当前处于震荡高位(价格:{f['close']}),建议尾盘或明日开盘*手动卖出网格仓*!"
# elif f['percent_b'] <= 0.0 or f['min_bias'] < -0.035:
elif ((f['close'] > f['prev_close'] and f['cci'] < f['prev_cci']) ## cci顶背离
and (f['K'] < f['D']) ## k线在d线之下
and (f['close'] < f['ma5'])): ## 收盘价在5日均线下
msg += f"🟢 *【建议高抛】*:当前处于震荡高位(价格:{f['close']}),建议尾盘或明日开盘*手动卖出网格仓*!"
elif ((f['cci'] < 100 and f['prev_cci'] > 100) ## cci从100跌到100以下
and (f['K'] < f['D']) ## k线在d线之下
and (f['close'] < f['ma5'])): ## 收盘价在5日均线下
msg += f"🟢 *【建议高抛】*:当前处于震荡高位(价格:{f['close']}),建议尾盘或明日开盘*手动卖出网格仓*!"
## 盘整阶段,两个指标会触发买入提醒
## kdj金叉,且cci连续两天上涨,且收盘价在5日均线上
## cci连续两天上涨,且k线在d线上,且收盘价在5日均线上
elif ((f['cci'] > f['prev_cci'] and f['prev_cci'] > f['prev_cci_2']) ## cci连续两天上涨 elif ((f['cci'] > f['prev_cci'] and f['prev_cci'] > f['prev_cci_2']) ## cci连续两天上涨
and (f['K'] > f['D'] and f['prev_K'] <= f['prev_D']) ## kdj金叉 and (f['K'] > f['D'] and f['prev_K'] <= f['prev_D']) ## kdj金叉
and (f['close'] > f['ma5'])): ## 收盘价站上五日线 and (f['close'] > f['ma5'])): ## 收盘价站上五日线
msg += f"🔴 *【建议低吸】*:当前处于震荡超跌区(价格:{f['close']}J{f['J']}),建议尾盘或明日开盘*手动买回筹码*!" msg += f"🔴 *【建议低吸】*:当前处于震荡超跌区(价格:{f['close']}),建议尾盘或明日开盘*手动买回筹码*!"
elif ((f['cci'] > f['prev_cci'] and f['prev_cci'] > f['prev_cci_2'] and f['prev_cci_2'] < f['prev_cci_3'])
and (f['K'] >= f['D'])
and (f['close'] > f['ma5'])):
msg += f"🔴 *【建议低吸】*:当前处于震荡超跌区(价格:{f['close']}),建议尾盘或明日开盘*手动买回筹码*!"
else: else:
msg += "⚪ *【建议观望】*:处于安全中枢内,未触及边界,明天*不要乱动*。" msg += "⚪ *【建议观望】*:处于安全中枢内,未触及边界,明天*不要乱动*。"
elif self.current_state == "STATE_3_MAIN_WAVE": elif self.current_state == "STATE_3_MAIN_WAVE":
+2
View File
@@ -84,6 +84,7 @@ class FeatureEngine:
latest = self.df.iloc[-1] latest = self.df.iloc[-1]
prev = self.df.iloc[-2] prev = self.df.iloc[-2]
prev_2 = self.df.iloc[-3] prev_2 = self.df.iloc[-3]
prev_3 = self.df.iloc[-4]
# 如果 5分钟线数据拿到了,现价以 5分钟最新收盘价为准(更接近 14:48 真实盘面) # 如果 5分钟线数据拿到了,现价以 5分钟最新收盘价为准(更接近 14:48 真实盘面)
# 如果没拿到,退化使用日线昨日收盘(做测试用) # 如果没拿到,退化使用日线昨日收盘(做测试用)
@@ -123,6 +124,7 @@ class FeatureEngine:
features["cci"] = latest["cci"] features["cci"] = latest["cci"]
features["prev_cci"] = prev["cci"] features["prev_cci"] = prev["cci"]
features["prev_cci_2"] = prev_2["cci"] features["prev_cci_2"] = prev_2["cci"]
features["prev_cci_3"] = prev_3["cci"]
history_bw = self.df["bandwidth"].iloc[-250:] history_bw = self.df["bandwidth"].iloc[-250:]
features["bw_quantile"] = (history_bw < latest["bandwidth"]).mean() features["bw_quantile"] = (history_bw < latest["bandwidth"]).mean()