combined_condition update

This commit is contained in:
zhangkun9038@dingtalk.com 2025-06-01 04:08:47 +00:00
parent 75ffe320d0
commit 92371eb784

View File

@ -277,13 +277,19 @@ class FreqaiPrimer(IStrategy):
logger.warning(f"[{pair}] ⚠️ &-price_value_divergence 列缺失,跳过该条件") logger.warning(f"[{pair}] ⚠️ &-price_value_divergence 列缺失,跳过该条件")
if len(conditions) > 0: if len(conditions) > 0:
dataframe.loc[reduce(lambda x, y: x & y, conditions), 'enter_long'] = 1 combined_condition = reduce(lambda x, y: x & y, conditions)
# 检查是否同时有卖出信号 if combined_condition.any():
if 'exit_long' in dataframe.columns and (dataframe["exit_long"] == 1).any(): dataframe.loc[combined_condition, 'enter_long'] = 1
logger.warning(f"[{pair}] 同时检测到买入和卖出信号,忽略买入信号")
dataframe['enter_long'] = 0 if 'exit_long' in dataframe.columns and (dataframe["exit_long"] == 1).any():
logger.warning(f"[{pair}] 同时检测到买入和卖出信号,忽略买入信号")
dataframe['enter_long'] = 0
else:
logger.debug(f"[{pair}] 入场信号触发,条件满足")
else: else:
logger.debug(f"[{pair}] 入场信号触发,条件满足") # 改为 DEBUG 级别 logger.debug(f"[{pair}] 买入条件均不满足,未触发入场信号")
else:
logger.debug(f"[{pair}] 无有效买入条件")
return dataframe return dataframe