改成预测未来6小时能否达到24小时最高点
This commit is contained in:
parent
858774189a
commit
8a6dcc0fe0
@ -374,11 +374,17 @@ class FreqaiPrimer(IStrategy):
|
||||
|
||||
# 入场标签:未来窗口内的最高价是否超过动态阈值
|
||||
future_max = dataframe["close"].rolling(window=label_horizon, min_periods=1).max().shift(-label_horizon + 1)
|
||||
# ========== 【关键修复】strong_bear 市场:改用「突破前24小时高点」作为真反转信号 ==========
|
||||
# 计算前24小时最高价(滚动窗口24根1h K线 = 24小时)
|
||||
recent_high_24h = dataframe['high'].rolling(window=24, min_periods=1).max().shift(1)
|
||||
|
||||
# 对 strong_bear 市场单独应用新逻辑;其余市场保持原逻辑
|
||||
dataframe["&s-entry_signal"] = np.where(
|
||||
future_max > dataframe["close"] * entry_up_threshold,
|
||||
1,
|
||||
0,
|
||||
dataframe['market_state'] == 'strong_bear',
|
||||
np.where(future_max > recent_high_24h, 1, 0),
|
||||
np.where(future_max > dataframe["close"] * entry_up_threshold, 1, 0)
|
||||
)
|
||||
# ========== 【修复结束】==========
|
||||
|
||||
# 出场标签:未来窗口内的最低价是否跌破动态阈值
|
||||
future_min = dataframe["close"].rolling(window=label_horizon, min_periods=1).min().shift(-label_horizon + 1)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user