stable1 5

This commit is contained in:
zhangkun9038@dingtalk.com 2025-04-28 17:55:14 +08:00
parent 4b2fd054b5
commit bb7a4af33a

View File

@ -280,11 +280,13 @@ class FreqaiExampleStrategy(IStrategy):
# 更保守的追踪止损设置
self.trailing_stop_positive = 0.05 # 追踪止损触发点
self.trailing_stop_positive_offset = 0.1 # 追踪止损偏移量
logger.info(f"动态参数buy_rsi={self.buy_rsi.value}, sell_rsi={self.sell_rsi.value}, "
f"stoploss={self.stoploss}, trailing_stop_positive={self.trailing_stop_positive}")
dataframe.replace([np.inf, -np.inf], 0, inplace=True)
exit_long_conditions = [
(df["rsi"] > df["sell_rsi_pred"]), # RSI 高于卖出阈值
(df["volume"] > df["volume"].rolling(window=10).mean()), # 成交量高于近期均值
(df["close"] < df["bb_middleband"]), # 价格低于布林带中轨
(df["close"] < df["bb_lowerband"].shift(1)), # 当前价格低于上一周期的布林带下轨
(df["volume"] < df["volume"].shift(1) * 0.9) # 当前成交量低于上一周期的10%
]
dataframe.ffill(inplace=True)
dataframe.fillna(0, inplace=True)