revert to HEAD^^
This commit is contained in:
parent
5b3ac4e374
commit
ad73d9a4ed
@ -406,18 +406,12 @@ class FreqaiPrimer(IStrategy):
|
||||
trend_score = self.get_market_trend(dataframe=dataframe, metadata=metadata)
|
||||
|
||||
# 动态调整成交量和 RSI 阈值
|
||||
# 使用 Hyperopt 参数动态调整成交量 Z 分数阈值
|
||||
volume_z_score_min = self.buy_params['volume_z_score_min']
|
||||
volume_z_score_max = self.buy_params['volume_z_score_max']
|
||||
volume_z_score_min = 0.5
|
||||
volume_z_score_max = 1.5
|
||||
volume_z_score_threshold = self.linear_map(trend_score, 0, 100, volume_z_score_max, volume_z_score_min)
|
||||
logger.info(f"[{pair}] 动态调整成交量 Z 分数阈值:{volume_z_score_threshold:.2f} (趋势得分: {trend_score})")
|
||||
|
||||
# 使用 Hyperopt 参数动态调整 RSI 阈值
|
||||
rsi_min = self.buy_params['rsi_min']
|
||||
rsi_max = self.buy_params['rsi_max']
|
||||
rsi_min = 35
|
||||
rsi_max = 55
|
||||
rsi_threshold = self.linear_map(trend_score, 0, 100, rsi_max, rsi_min)
|
||||
logger.info(f"[{pair}] 动态调整 RSI 阈值:{rsi_threshold:.2f} (趋势得分: {trend_score})")
|
||||
logger.info(f"[{pair}] 动态调整 RSI 阈值:{rsi_threshold:.2f} (趋势得分: {trend_score})")
|
||||
stochrsi_min = 25
|
||||
stochrsi_max = 45
|
||||
stochrsi_threshold = self.linear_map(trend_score, 0, 100, stochrsi_max, stochrsi_min)
|
||||
@ -569,17 +563,9 @@ class FreqaiPrimer(IStrategy):
|
||||
|
||||
# 综合卖出条件:根据 trend_score 调整逻辑
|
||||
#如果趋势得分为100,拒绝退出
|
||||
|
||||
# 当趋势得分为 100 时,完全禁止出场
|
||||
trend_top_threshold = 100
|
||||
if trend_score >= trend_top_threshold:
|
||||
logger.info(f"[{pair}] 趋势得分为 {trend_score},完全禁止出场")
|
||||
if trend_score > 92:
|
||||
logger.info(f"[{pair}] 趋势得分为100,拒绝退出")
|
||||
return dataframe
|
||||
|
||||
# 动态调整 sell_threshold,趋势越强,阈值越高
|
||||
sell_threshold_multiplier = self.linear_map(trend_score, 0, 100, 1.0, 1.5)
|
||||
self.sell_threshold *= sell_threshold_multiplier
|
||||
logger.info(f"[{pair}] 动态调整卖出阈值:{self.sell_threshold:.4f} (趋势得分: {trend_score})")
|
||||
|
||||
trend_sell_threshold = 85
|
||||
if trend_score > trend_sell_threshold:
|
||||
@ -615,26 +601,11 @@ class FreqaiPrimer(IStrategy):
|
||||
|
||||
def buy_space(self):
|
||||
return [
|
||||
# Buy thresholds
|
||||
DecimalParameter(-0.1, -0.01, name="buy_threshold_min", default=-0.035, decimals=3),
|
||||
DecimalParameter(-0.02, -0.001, name="buy_threshold_max", default=-0.001, decimals=3),
|
||||
|
||||
# Add position threshold
|
||||
DecimalParameter(-0.05, -0.01, name="add_position_threshold", default=-0.021, decimals=3),
|
||||
|
||||
# Cooldown period (in minutes)
|
||||
IntParameter(1, 10, name="cooldown_period_minutes", default=9),
|
||||
|
||||
# Maximum entry position adjustments
|
||||
IntParameter(1, 3, name="max_entry_position_adjustment", default=3),
|
||||
|
||||
# Volume Z-score thresholds
|
||||
DecimalParameter(0.3, 0.6, name="volume_z_score_min", default=0.5, decimals=2),
|
||||
DecimalParameter(1.0, 1.8, name="volume_z_score_max", default=1.5, decimals=2),
|
||||
|
||||
# RSI thresholds
|
||||
IntParameter(30, 40, name="rsi_min", default=35),
|
||||
IntParameter(50, 70, name="rsi_max", default=55)
|
||||
DecimalParameter(-0.1, -0.01, name="buy_threshold_min"),
|
||||
DecimalParameter(-0.02, -0.001, name="buy_threshold_max"),
|
||||
DecimalParameter(-0.05, -0.01, name="add_position_threshold", default=-0.02),
|
||||
IntParameter(1, 10, name="cooldown_period_minutes", default=5),
|
||||
IntParameter(1, 3, name="max_entry_position_adjustment", default=2)
|
||||
]
|
||||
|
||||
def sell_space(self):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user