新思路优化adjust_trade_position
This commit is contained in:
parent
64f749eb20
commit
1038a92998
@ -28,10 +28,11 @@
|
||||
"rsi_bull_threshold": 54,
|
||||
"rsi_length": 16,
|
||||
"rsi_oversold": 47,
|
||||
"stake_divisor": 2.867,
|
||||
"stochrsi_bull_threshold": 36,
|
||||
"stochrsi_neutral_threshold": 30,
|
||||
"volume_multiplier": 1.6,
|
||||
"stake_divisor": 2.867
|
||||
"step_coefficient": 0.96
|
||||
},
|
||||
"sell": {
|
||||
"exit_bb_upper_deviation": 0.99,
|
||||
@ -44,5 +45,5 @@
|
||||
"protection": {}
|
||||
},
|
||||
"ft_stratparam_v": 1,
|
||||
"export_time": "2025-09-30 11:24:57.117719+00:00"
|
||||
"export_time": "2025-10-01 04:05:41.897882+00:00"
|
||||
}
|
||||
@ -103,8 +103,9 @@ class FreqaiPrimer(IStrategy):
|
||||
h1_max_consecutive_candles = IntParameter(1, 4, default=2, optimize=False, load=True, space='buy')
|
||||
# 定义可优化参数
|
||||
max_entry_adjustments = IntParameter(2, 5, default=3, optimize=False, load=True, space='buy') # 最大加仓次数
|
||||
add_position_callback = DecimalParameter(0.03, 0.06, decimals=3, default=0.047, optimize=False, load=True, space='buy') # 加仓回调百分比
|
||||
stake_divisor = DecimalParameter(2, 4, decimals=3, default=2.00, optimize=True, load=True, space='buy') # 加仓金额分母
|
||||
add_position_callback = DecimalParameter(0.03, 0.06, decimals=3, default=0.053, optimize=True, load=True, space='buy') # 加仓回调百分比
|
||||
stake_divisor = DecimalParameter(2, 4, decimals=3, default=2.867, optimize=True, load=True, space='buy') # 加仓金额分母
|
||||
step_coefficient = DecimalParameter(0.5, 1.5, decimals=2, default=0.92, optimize=True, load=True, space='buy') # 加仓金额分母
|
||||
|
||||
# 线性ROI参数 - 用于线性函数: y = (a * (x + k)) + t
|
||||
roi_param_a = DecimalParameter(-0.0002, -0.00005, decimals=5, default=-0.0001, optimize=False, load=True, space='sell') # 系数a
|
||||
@ -114,7 +115,7 @@ class FreqaiPrimer(IStrategy):
|
||||
exit_bb_upper_deviation = DecimalParameter(0.98, 1.02, decimals=2, default=1.0, optimize=False, load=True, space='sell')
|
||||
exit_volume_multiplier = DecimalParameter(1.5, 3.0, decimals=1, default=2.0, optimize=False, load=True, space='sell')
|
||||
|
||||
rsi_overbought = IntParameter(57, 59, default=58, optimize=True, load=True, space='sell')
|
||||
rsi_overbought = IntParameter(57, 59, default=58, optimize=False, load=True, space='sell')
|
||||
|
||||
|
||||
def informative_pairs(self):
|
||||
@ -631,7 +632,7 @@ class FreqaiPrimer(IStrategy):
|
||||
adjustment_count = entry_count - 1 # 已加仓次数
|
||||
|
||||
# 计算加仓金额: (initial_stake / stake_divisor) ^ (adjustment_count + 1)
|
||||
additional_stake = (initial_stake / self.stake_divisor.value) ** (adjustment_count + 1)
|
||||
additional_stake = (self.step_coefficient.value * initial_stake / self.stake_divisor.value) ** (adjustment_count + 1)
|
||||
|
||||
# 确保加仓金额在允许的范围内
|
||||
additional_stake = max(min_stake, min(additional_stake, max_stake - trade.stake_amount))
|
||||
|
||||
@ -169,5 +169,5 @@ docker-compose run --rm freqtrade hyperopt $PAIRS_FLAG \
|
||||
-e 1000 \
|
||||
-j 28 \
|
||||
--hyperopt-loss SharpeHyperOptLossDaily \
|
||||
--spaces buy sell \
|
||||
--spaces buy \
|
||||
--fee 0.0016
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user