stable1 4
This commit is contained in:
parent
9acebf9952
commit
5ef9dd3d61
@ -309,15 +309,12 @@ 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_upperband"].shift(1)), # 当前价格高于上一周期的布林带上轨
|
||||
(df["volume"] > df["volume"].shift(1) * 1.1) # 当前成交量高于上一周期的10%
|
||||
(df["close"] > df["bb_middleband"]) # 价格高于布林带中轨
|
||||
]
|
||||
|
||||
# 如果 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))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user