This commit is contained in:
zhangkun9038@dingtalk.com 2025-04-28 22:30:11 +08:00
parent ec8447e116
commit 84344f7f60

View File

@ -324,14 +324,9 @@ class FreqaiExampleStrategy(IStrategy):
return dataframe
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
# 改进买入信号条件
# 使用 centralized 方法计算 MACD
# 确保使用 centralized 方法计算 MACD
dataframe = self.calculate_macd(dataframe)
# 再次检查 MACD 列是否存在
if "macd" not in dataframe.columns or "macdsignal" not in dataframe.columns:
logger.error("MACD 或 MACD 信号列仍然缺失,无法生成买入信号。")
raise ValueError("dataframe 缺少必要的 MACD 列且无法重新计算。")
enter_long_conditions = [
(dataframe["rsi"] < dataframe["buy_rsi_pred"]), # RSI 低于买入阈值
(