绿色通道入场机制

This commit is contained in:
zhangkun9038@dingtalk.com 2025-08-18 01:22:53 +08:00
parent 9494d7f557
commit 6aea35d835

View File

@ -650,19 +650,25 @@ class FreqaiPrimer(IStrategy):
stochrsi_value = dataframe["stochrsi_k"].iloc[-1]
bb_close_value = dataframe["close"].iloc[-1]
bb_lower_value = dataframe["bb_lowerband"].iloc[-1]
# 定义条件名称和状态 - 确保所有cond变量都已定义
cond6_defined = ~bearish_signal_aligned if 'bearish_signal_aligned' in locals() else pd.Series([True] * len(dataframe))
cond7_defined = ~stochrsi_overbought_aligned if 'stochrsi_overbought_aligned' in locals() else pd.Series([True] * len(dataframe))
# 定义条件名称和状态
conditions_summary = [
("&-price_value_divergence", divergence_value, "<", self.buy_threshold, cond1.iloc[-1]),
("volume_z_score", volume_z_score_value, ">", volume_z_score_threshold, cond2.iloc[-1]),
("rsi", rsi_value, "<", rsi_threshold, cond3.iloc[-1]),
("close <= bb_lowerband", bb_close_value, "<=", bb_lower_value, cond4.iloc[-1]),
("stochrsi_k", stochrsi_value, "<", stochrsi_threshold, cond5.iloc[-1]),
("非熊市", None, None, None, cond6_defined.iloc[-1]),
("STOCHRSI未持续超买", None, None, None, cond7_defined.iloc[-1]),
]
# 根据趋势状态添加对应的条件6和7
if trend_status == "bullish" and open_trades <= 2:
# 绿色通道只有5个条件
pass
else:
# 其他通道有7个条件
conditions_summary.extend([
("非熊市", None, None, None, cond6.iloc[-1]),
("STOCHRSI未持续超买", None, None, None, cond7.iloc[-1]),
])
# 输出每个条件的状态
logger.info(f"[{pair}] === 买入条件检查 ===")