From baf77c2994915b6ba2ddd9e30a71742e0a7d6f53 Mon Sep 17 00:00:00 2001 From: "zhangkun9038@dingtalk.com" Date: Fri, 25 Jul 2025 00:50:22 +0800 Subject: [PATCH] use ema300 --- freqtrade/templates/freqaiprimer.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/freqtrade/templates/freqaiprimer.py b/freqtrade/templates/freqaiprimer.py index 5c5a3649..d15fadfd 100644 --- a/freqtrade/templates/freqaiprimer.py +++ b/freqtrade/templates/freqaiprimer.py @@ -258,6 +258,7 @@ class FreqaiPrimer(IStrategy): # 计算主时间框架(3m)指标 dataframe["ema200"] = ta.EMA(dataframe, timeperiod=200) + dataframe["ema300"] = ta.EMA(dataframe, timeperiod=300) dataframe["price_value_divergence"] = (dataframe["close"] - dataframe["ema200"]) / dataframe["ema200"] upperband, middleband, lowerband = ta.BBANDS(dataframe["close"], timeperiod=20, nbdevup=2.0, nbdevdn=2.0) dataframe["bb_upperband"] = upperband @@ -433,6 +434,7 @@ class FreqaiPrimer(IStrategy): cond5 = (dataframe["stochrsi_k"] < stochrsi_threshold) cond6 = ~bearish_signal_aligned cond7 = ~stochrsi_overbought_aligned + cond8 = (dataframe["close"] >= dataframe["ema300"]) # 记录 cond6 和 cond7 的触发情况 logger.debug(f"[{pair}] cond6 (非熊市) 触发率: {(~bearish_signal_aligned).mean():.2%}, " @@ -457,6 +459,7 @@ class FreqaiPrimer(IStrategy): f"close={bb_close_value:.6f} <= bb_lowerband={bb_lower_value:.6f}: {cond4.iloc[-1]}, " f"stochrsi_k={stochrsi_value:.2f} < {stochrsi_threshold:.2f}: {cond5.iloc[-1]}, " f"非熊市={cond6.iloc[-1]}, " + f"ema300={cond8.iloc[-1]}, " f"STOCHRSI未持续超买={cond7.iloc[-1]}") else: logger.warning(f"[{pair}] &-price_value_divergence 列缺失,跳过买入信号生成")