From 9acebf995231941b387d2e2dde6a4f10f6d3878b Mon Sep 17 00:00:00 2001 From: "zhangkun9038@dingtalk.com" Date: Mon, 28 Apr 2025 17:53:27 +0800 Subject: [PATCH] stable1 3 --- freqtrade/templates/FreqaiExampleStrategy.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/freqtrade/templates/FreqaiExampleStrategy.py b/freqtrade/templates/FreqaiExampleStrategy.py index 133151b2..74ab4734 100644 --- a/freqtrade/templates/FreqaiExampleStrategy.py +++ b/freqtrade/templates/FreqaiExampleStrategy.py @@ -309,12 +309,15 @@ class FreqaiExampleStrategy(IStrategy): enter_long_conditions = [ (df["rsi"] < df["buy_rsi_pred"]), # RSI 低于买入阈值 (df["volume"] > df["volume"].rolling(window=10).mean() * 1.2), # 成交量高于近期均值20% - (df["close"] > df["bb_middleband"]) # 价格高于布林带中轨 + (df["close"] > df["bb_middleband"]), # 价格高于布林带中轨 + (df["close"] > df["bb_upperband"].shift(1)), # 当前价格高于上一周期的布林带上轨 + (df["volume"] > df["volume"].shift(1) * 1.1) # 当前成交量高于上一周期的10% ] # 如果 MACD 列存在,则添加 MACD 金叉条件 if "macd" in df.columns and "macdsignal" in df.columns: enter_long_conditions.append((df["macd"] > df["macdsignal"])) + enter_long_conditions.append((df["macd"] > df["macd"].shift(1))) # MACD 上升趋势 # 确保模型预测为买入 enter_long_conditions.append((df["do_predict"] == 1))