绿色通道入场机制

This commit is contained in:
zhangkun9038@dingtalk.com 2025-08-18 01:33:39 +08:00
parent 6aea35d835
commit 55c25baf51

View File

@ -643,13 +643,18 @@ class FreqaiPrimer(IStrategy):
# 绿色通道和趋势状态的条件已经设置好buy_condition
conditions.append(buy_condition)
# 调试日志
# 调试日志 - 添加更多调试信息
divergence_value = dataframe["&-price_value_divergence"].iloc[-1]
volume_z_score_value = dataframe["volume_z_score"].iloc[-1]
rsi_value = dataframe["rsi"].iloc[-1]
stochrsi_value = dataframe["stochrsi_k"].iloc[-1]
bb_close_value = dataframe["close"].iloc[-1]
bb_lower_value = dataframe["bb_lowerband"].iloc[-1]
bb_upper_value = dataframe["bb_upperband"].iloc[-1]
# 输出关键指标以便调试
logger.info(f"[{pair}] 📊 关键指标 - 偏离度: {divergence_value:.6f}, RSI: {rsi_value:.2f}, STOCHRSI: {stochrsi_value:.2f}, 价格: {bb_close_value:.4f}, 下轨: {bb_lower_value:.4f}, 上轨: {bb_upper_value:.4f}")
logger.info(f"[{pair}] 🔍 买入阈值 - 偏离度: {self.buy_threshold:.6f}, RSI: {rsi_threshold:.2f}, STOCHRSI: {stochrsi_threshold:.2f}")
# 定义条件名称和状态
conditions_summary = [
("&-price_value_divergence", divergence_value, "<", self.buy_threshold, cond1.iloc[-1]),
@ -732,7 +737,7 @@ class FreqaiPrimer(IStrategy):
dataframe["stochrsi_k"] = stochrsi["fastk"]
dataframe["adx"] = ta.ADX(dataframe, timeperiod=14)
# 计算短期价格涨幅(最近 5 根 K 线,约 15 分钟)
dataframe["short_term_return"] = dataframe["close"].pct_change(5) * 100 # 百分比回报
dataframe["short_term_return"] = dataframe["close"].pct_change(5, fill_method=None) * 100 # 百分比回报
# 获取市场趋势得分
trend_score = self.get_market_trend(dataframe=dataframe, metadata={'pair': pair})
@ -1174,7 +1179,7 @@ class FreqaiPrimer(IStrategy):
kline_score += 15
elif pair_df["bearish_engulfing"].iloc[-1]:
kline_score -= 15
volatility = pair_df["close"].pct_change(10).std() * 100
volatility = pair_df["close"].pct_change(10, fill_method=None).std() * 100
if volatility > 0.5:
kline_score += 10 if price_score > 0 else -10