没有入场信号
This commit is contained in:
parent
4c10aeb152
commit
0806774f38
@ -392,11 +392,11 @@ class FreqaiPrimer(IStrategy):
|
||||
# 条件1: 价格接近布林带下轨
|
||||
close_to_bb_lower_1h = (dataframe['close'] <= dataframe['bb_lower_1h'] * 1.02)
|
||||
|
||||
# 条件2: RSI 不高于阈值
|
||||
rsi_condition_1h = dataframe['rsi_1h'] < self.rsi_oversold
|
||||
# 条件2: RSI 不高于阈值(放宽阈值)
|
||||
rsi_condition_1h = dataframe['rsi_1h'] < 50 # 放宽 RSI 阈值
|
||||
|
||||
# 条件3: StochRSI 处于超卖区域
|
||||
stochrsi_condition_1h = (dataframe['stochrsi_k_1h'] < 20) & (dataframe['stochrsi_d_1h'] < 20)
|
||||
# 条件3: StochRSI 处于超卖区域(放宽阈值)
|
||||
stochrsi_condition_1h = (dataframe['stochrsi_k_1h'] < 30) & (dataframe['stochrsi_d_1h'] < 30) # 放宽 StochRSI 阈值
|
||||
|
||||
# 条件4: MACD 上升趋势
|
||||
macd_condition_1h = dataframe['macd_1h'] > dataframe['macd_signal_1h']
|
||||
@ -404,8 +404,13 @@ class FreqaiPrimer(IStrategy):
|
||||
# 辅助条件: 3m 和 15m 趋势确认
|
||||
trend_confirmation = (dataframe['trend_3m'] == 1) & (dataframe['trend_15m'] == 1)
|
||||
|
||||
# 合并所有条件
|
||||
final_condition = close_to_bb_lower_1h & rsi_condition_1h & stochrsi_condition_1h & macd_condition_1h & trend_confirmation
|
||||
# 合并所有条件(放宽逻辑组合)
|
||||
final_condition = (
|
||||
close_to_bb_lower_1h &
|
||||
(rsi_condition_1h | stochrsi_condition_1h) & # 允许 RSI 或 StochRSI 满足其一
|
||||
macd_condition_1h &
|
||||
trend_confirmation
|
||||
)
|
||||
|
||||
# 设置入场信号
|
||||
dataframe.loc[final_condition, 'enter_long'] = 1
|
||||
@ -417,6 +422,7 @@ class FreqaiPrimer(IStrategy):
|
||||
logger.info(f" - StochRSI 超卖: {stochrsi_condition_1h.sum()} 次")
|
||||
logger.info(f" - MACD 上升趋势: {macd_condition_1h.sum()} 次")
|
||||
logger.info(f" - 趋势确认: {trend_confirmation.sum()} 次")
|
||||
logger.info(f" - 最终条件: {final_condition.sum()} 次")
|
||||
|
||||
# 日志记录
|
||||
if dataframe['enter_long'].sum() > 0:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user