Hyperopt参数优化
This commit is contained in:
parent
0e4480d383
commit
b03221c697
@ -1,56 +1,58 @@
|
||||
{
|
||||
"strategy_name": "FreqaiPrimer",
|
||||
"export_time": "2025-12-03 00:03:56.464370+00:00",
|
||||
"ft_stratparam_v": 1,
|
||||
"params": {
|
||||
"roi": {},
|
||||
"stoploss": {
|
||||
"stoploss": -0.085
|
||||
},
|
||||
"trailing": {
|
||||
"trailing_stop": true,
|
||||
"trailing_stop_positive": 0.012,
|
||||
"trailing_stop_positive_offset": 0.025,
|
||||
"trailing_only_offset_is_reached": true
|
||||
"buy": {
|
||||
"add_bb_lower_proximity": 0.928,
|
||||
"add_position_callback": 0.051,
|
||||
"add_position_decrease_ratio": 0.61,
|
||||
"add_rsi_oversold_threshold": 21,
|
||||
"add_stochrsi_oversold": 14,
|
||||
"adjust_multiplier": 1.6,
|
||||
"bb_length": 22,
|
||||
"bb_lower_deviation": 1.038,
|
||||
"bb_std": 3.8,
|
||||
"bb_width_threshold": 0.019,
|
||||
"h1_max_candles": 16,
|
||||
"h1_max_consecutive_candles": 1,
|
||||
"h1_rapid_rise_threshold": 0.128,
|
||||
"max_entry_adjustments": 4,
|
||||
"min_condition_count": 1,
|
||||
"rsi_bull_threshold": 45,
|
||||
"rsi_length": 17,
|
||||
"rsi_oversold": 31,
|
||||
"stochrsi_bull_threshold": 22,
|
||||
"stochrsi_neutral_threshold": 26,
|
||||
"volume_multiplier": 5.8
|
||||
},
|
||||
"max_open_trades": {
|
||||
"max_open_trades": 5
|
||||
},
|
||||
"buy": {
|
||||
"add_bb_lower_proximity": 0.871,
|
||||
"add_position_callback": 0.057,
|
||||
"add_position_decrease_ratio": 0.71,
|
||||
"add_rsi_oversold_threshold": 37,
|
||||
"add_stochrsi_oversold": 14,
|
||||
"adjust_multiplier": 0.87,
|
||||
"bb_length": 58,
|
||||
"bb_lower_deviation": 0.931,
|
||||
"bb_std": 4.4,
|
||||
"bb_width_threshold": 0.016,
|
||||
"h1_max_candles": 40,
|
||||
"h1_max_consecutive_candles": 1,
|
||||
"h1_rapid_rise_threshold": 0.166,
|
||||
"max_entry_adjustments": 6,
|
||||
"min_condition_count": 2,
|
||||
"rsi_bull_threshold": 44,
|
||||
"rsi_length": 30,
|
||||
"rsi_oversold": 27,
|
||||
"stochrsi_bull_threshold": 33,
|
||||
"stochrsi_neutral_threshold": 18,
|
||||
"volume_multiplier": 3.4
|
||||
},
|
||||
"protection": {},
|
||||
"roi": {},
|
||||
"sell": {
|
||||
"exit_bb_upper_deviation": 0.913,
|
||||
"exit_profit_tier1": 0.034,
|
||||
"exit_profit_tier2": 0.17,
|
||||
"exit_reduce_tier1": 0.35,
|
||||
"exit_reduce_tier2": 0.37,
|
||||
"exit_rsi_threshold": 57,
|
||||
"exit_volume_multiplier": 2,
|
||||
"exit_bb_upper_deviation": 0.968,
|
||||
"exit_profit_tier1": 0.091,
|
||||
"exit_profit_tier2": 0.189,
|
||||
"exit_reduce_tier1": 0.23,
|
||||
"exit_reduce_tier2": 0.3,
|
||||
"exit_rsi_threshold": 62,
|
||||
"exit_volume_multiplier": 2.0,
|
||||
"max_reduce_adjustments": 4,
|
||||
"reduce_coefficient": 0.229,
|
||||
"reduce_profit_base": 0.02
|
||||
"reduce_coefficient": 0.172,
|
||||
"reduce_profit_base": 0.023
|
||||
},
|
||||
"protection": {}
|
||||
"stoploss": {
|
||||
"stoploss": -0.085
|
||||
},
|
||||
"trailing": {
|
||||
"trailing_only_offset_is_reached": true,
|
||||
"trailing_stop": true,
|
||||
"trailing_stop_positive": 0.012,
|
||||
"trailing_stop_positive_offset": 0.025
|
||||
}
|
||||
},
|
||||
"ft_stratparam_v": 1,
|
||||
"export_time": "2025-12-03 00:03:56.464370+00:00"
|
||||
}
|
||||
"strategy_name": "FreqaiPrimer",
|
||||
"trailing_only_offset_is_reached": false,
|
||||
"trailing_stop": false
|
||||
}
|
||||
@ -81,50 +81,52 @@ class FreqaiPrimer(IStrategy):
|
||||
timeframe = "3m" # 主时间框架为 3 分钟
|
||||
can_short = False # 禁用做空
|
||||
|
||||
# [propertiesGrp_List]--------------------------------------------------------------------------------------------------------------------------------------
|
||||
# [propertiesGrp step="1" name="第一轮优化" epochs="160" space="buy" description="入场基础条件优化,入场确认条件优化"]
|
||||
bb_std = DecimalParameter(2.0, 6.0, decimals=2, default=3.2, optimize=True, load=True, space='buy') # 安全:2.0-5.0
|
||||
rsi_length = IntParameter(10, 30, default=30, optimize=True, load=True, space='buy') # 安全:10-30
|
||||
bb_lower_deviation = DecimalParameter(0.92, 1.15, decimals=3, default=1.006, optimize=True, load=True, space='buy') # 安全:0.92-1.15
|
||||
stochrsi_bull_threshold = IntParameter(20, 50, default=48, optimize=True, load=True, space='buy') # 安全:20-50
|
||||
volume_multiplier = DecimalParameter(1.5, 6.0, decimals=1, default=3.6, optimize=True, load=True, space='buy') # 安全:1.5-6.0
|
||||
min_condition_count = IntParameter(1, 2, default=2, optimize=True, load=True, space='buy') # 最多只允许2个条件!
|
||||
bb_length = IntParameter(20, 60, default=21, optimize=True, load=True, space='buy') # 安全:20-60
|
||||
# [/propertiesGrp]
|
||||
|
||||
# [propertiesGrp step="2" name="第二轮优化 - 剧烈拉升检测" epochs="240" space="buy" description="防追高核心参数,绝对不能放宽!"]
|
||||
rsi_oversold = IntParameter(20, 50, default=23, optimize=True, load=True, space='buy') # 安全:20-50
|
||||
rsi_bull_threshold = IntParameter(40, 68, default=45, optimize=True, load=True, space='buy') # 安全:40-68
|
||||
stochrsi_neutral_threshold = IntParameter(15, 40, default=16, optimize=True, load=True, space='buy') # 安全:15-40
|
||||
bb_width_threshold = DecimalParameter(0.003, 0.030, decimals=3, default=0.011, optimize=True, load=True, space='buy') # 安全:0.003-0.030
|
||||
h1_max_candles = IntParameter(16, 50, default=19, optimize=True, load=True, space='buy') # 黄金区间!绝不能超过50
|
||||
h1_rapid_rise_threshold = DecimalParameter(0.08, 0.22, decimals=3, default=0.192, optimize=True, load=True, space='buy') # 0.08-0.22 实盘最稳
|
||||
h1_max_consecutive_candles = IntParameter(1, 2, default=1, optimize=True, load=True, space='buy') # 固定为1最稳,2也行
|
||||
# [/propertiesGrp]
|
||||
|
||||
# [propertiesGrp step="3" name="第三轮优化 - 加仓策略" epochs="220" space="buy" description="加仓精准度与金额管理,严防爆仓"]
|
||||
add_position_callback = DecimalParameter(0.047, 0.090, decimals=3, default=0.067, optimize=True, load=True, space='buy') # 2.5%-7.0% 回调才加
|
||||
add_rsi_oversold_threshold = IntParameter(15, 40, default=23, optimize=True, load=True, space='buy') # 不能太低
|
||||
add_stochrsi_oversold = IntParameter(10, 35, default=23, optimize=True, load=True, space='buy')
|
||||
add_bb_lower_proximity = DecimalParameter(0.85, 1.20, decimals=3, default=0.987, optimize=True, load=True, space='buy') # 不能离下轨太远
|
||||
add_position_decrease_ratio= DecimalParameter(0.30, 0.80, decimals=2, default=0.55, optimize=True, load=True, space='buy') # 递减比例别太激进
|
||||
max_entry_adjustments = IntParameter(2, 7, default=6, optimize=True, load=True, space='buy') # 最多7次加仓,防爆仓
|
||||
adjust_multiplier = DecimalParameter(0.6, 1.6, decimals=2, default=0.98, optimize=True, load=True, space='buy') # 别让加仓金额指数爆炸
|
||||
# [/propertiesGrp]
|
||||
|
||||
# [propertiesGrp step="4" name="第四轮优化 - 出场与分级止盈" epochs="200" space="sell" description="出场条件与分级止盈,减仓与风险管理"]
|
||||
exit_bb_upper_deviation = DecimalParameter(0.90, 1.15, decimals=3, default=0.919, optimize=True, load=True, space='sell')
|
||||
exit_volume_multiplier = DecimalParameter(2.0, 7.0, decimals=1, default=2.2, optimize=True, load=True, space='sell')
|
||||
exit_rsi_threshold = IntParameter(55, 72, default=57, optimize=True, load=True, space='sell') # 牛市也能出得了场
|
||||
exit_profit_tier1 = DecimalParameter(0.03, 0.12, decimals=3, default=0.116, optimize=True, load=True, space='sell')
|
||||
exit_reduce_tier1 = DecimalParameter(0.20, 0.70, decimals=2, default=0.21, optimize=True, load=True, space='sell')
|
||||
exit_profit_tier2 = DecimalParameter(0.08, 0.20, decimals=3, default=0.152, optimize=True, load=True, space='sell')
|
||||
exit_reduce_tier2 = DecimalParameter(0.15, 0.60, decimals=2, default=0.17, optimize=True, load=True, space='sell')
|
||||
reduce_profit_base = DecimalParameter(0.02, 0.12, decimals=3, default=0.081, optimize=True, load=True, space='sell')
|
||||
reduce_coefficient = DecimalParameter(0.15, 0.55, decimals=3, default=0.326, optimize=True, load=True, space='sell')
|
||||
max_reduce_adjustments = IntParameter(1, 4, default=2, optimize=True, load=True, space='sell') # 最多4次减仓就够了
|
||||
# [/propertiesGrp]
|
||||
# [/propertiesGrp_List]-----------------------------------------------------------------------------------------------------------------------------
|
||||
# [propertiesGrp_List]
|
||||
|
||||
# [propertiesGrp step="1" name="第一轮优化" space="buy" epochs="160" description="入场基础条件优化,入场确认条件优化"]
|
||||
bb_length=IntParameter(20, 60, optimize=True, load=True, default=21, space='buy') # [PARAM]
|
||||
bb_lower_deviation=DecimalParameter(0.92, 1.15, decimals=3, optimize=True, load=True, default=1.006, space='buy') # [PARAM]
|
||||
bb_std=DecimalParameter(2, 6, decimals=2, optimize=True, load=True, default=3.2, space='buy') # [PARAM]
|
||||
min_condition_count=IntParameter(1, 2, optimize=True, load=True, default=2, space='buy') # [PARAM]
|
||||
rsi_length=IntParameter(10, 30, optimize=True, load=True, default=30, space='buy') # [PARAM]
|
||||
stochrsi_bull_threshold=IntParameter(20, 50, optimize=True, load=True, default=48, space='buy') # [PARAM]
|
||||
volume_multiplier=DecimalParameter(1.5, 6, decimals=1, optimize=True, load=True, default=3.6, space='buy') # [PARAM]
|
||||
# [/propertiesGrp]
|
||||
|
||||
# [propertiesGrp step="2" name="第二轮优化 - 剧烈拉升检测" space="buy" epochs="240" description="防追高核心参数,绝对不能放宽!"]
|
||||
bb_width_threshold=DecimalParameter(0.003, 0.03, decimals=3, optimize=True, load=True, default=0.011, space='buy') # [PARAM]
|
||||
h1_max_candles=IntParameter(16, 50, optimize=True, load=True, default=19, space='buy') # [PARAM]
|
||||
h1_max_consecutive_candles=IntParameter(1, 2, optimize=True, load=True, default=1, space='buy') # [PARAM]
|
||||
h1_rapid_rise_threshold=DecimalParameter(0.08, 0.22, decimals=3, optimize=True, load=True, default=0.192, space='buy') # [PARAM]
|
||||
rsi_bull_threshold=IntParameter(40, 68, optimize=True, load=True, default=45, space='buy') # [PARAM]
|
||||
rsi_oversold=IntParameter(20, 50, optimize=True, load=True, default=23, space='buy') # [PARAM]
|
||||
stochrsi_neutral_threshold=IntParameter(15, 40, optimize=True, load=True, default=16, space='buy') # [PARAM]
|
||||
# [/propertiesGrp]
|
||||
|
||||
# [propertiesGrp step="3" name="第三轮优化 - 加仓策略" space="buy" epochs="220" description="加仓精准度与金额管理,严防爆仓"]
|
||||
add_bb_lower_proximity=DecimalParameter(0.85, 1.2, decimals=3, optimize=True, load=True, default=0.987, space='buy') # [PARAM]
|
||||
add_position_callback=DecimalParameter(0.047, 0.09, decimals=3, optimize=True, load=True, default=0.067, space='buy') # [PARAM]
|
||||
add_position_decrease_ratio=DecimalParameter(0.3, 0.8, decimals=2, optimize=True, load=True, default=0.55, space='buy') # [PARAM]
|
||||
add_rsi_oversold_threshold=IntParameter(15, 40, optimize=True, load=True, default=23, space='buy') # [PARAM]
|
||||
add_stochrsi_oversold=IntParameter(10, 35, optimize=True, load=True, default=23, space='buy') # [PARAM]
|
||||
adjust_multiplier=DecimalParameter(0.6, 1.6, decimals=2, optimize=True, load=True, default=0.98, space='buy') # [PARAM]
|
||||
max_entry_adjustments=IntParameter(2, 7, optimize=True, load=True, default=6, space='buy') # [PARAM]
|
||||
# [/propertiesGrp]
|
||||
|
||||
# [propertiesGrp step="4" name="第四轮优化 - 出场与分级止盈" space="sell" epochs="200" description="出场条件与分级止盈,减仓与风险管理"]
|
||||
exit_bb_upper_deviation=DecimalParameter(0.9, 1.15, decimals=3, optimize=True, load=True, default=0.919, space='sell') # [PARAM]
|
||||
exit_profit_tier1=DecimalParameter(0.03, 0.12, decimals=3, optimize=True, load=True, default=0.116, space='sell') # [PARAM]
|
||||
exit_profit_tier2=DecimalParameter(0.08, 0.2, decimals=3, optimize=True, load=True, default=0.152, space='sell') # [PARAM]
|
||||
exit_reduce_tier1=DecimalParameter(0.2, 0.7, decimals=2, optimize=True, load=True, default=0.21, space='sell') # [PARAM]
|
||||
exit_reduce_tier2=DecimalParameter(0.15, 0.6, decimals=2, optimize=True, load=True, default=0.17, space='sell') # [PARAM]
|
||||
exit_rsi_threshold=IntParameter(55, 72, optimize=True, load=True, default=57, space='sell') # [PARAM]
|
||||
exit_volume_multiplier=DecimalParameter(2, 7, decimals=1, optimize=True, load=True, default=2.2, space='sell') # [PARAM]
|
||||
max_reduce_adjustments=IntParameter(1, 4, optimize=True, load=True, default=2, space='sell') # [PARAM]
|
||||
reduce_coefficient=DecimalParameter(0.15, 0.55, decimals=3, optimize=True, load=True, default=0.326, space='sell') # [PARAM]
|
||||
reduce_profit_base=DecimalParameter(0.02, 0.12, decimals=3, optimize=True, load=True, default=0.081, space='sell') # [PARAM]
|
||||
# [/propertiesGrp]
|
||||
|
||||
# [/propertiesGrp_List]
|
||||
|
||||
def informative_pairs(self):
|
||||
pairs = self.dp.current_whitelist()
|
||||
|
||||
70
jsons/best_backtest.json
Normal file
70
jsons/best_backtest.json
Normal file
@ -0,0 +1,70 @@
|
||||
{
|
||||
"id": "EgdU7cbQw09t",
|
||||
"vmName": "rose",
|
||||
"startTime": "2025-12-07T00:45:25.340794224Z",
|
||||
"endTime": "2025-12-07T01:45:25.340794274Z",
|
||||
"fullHyperoptEventID": "t4tlEfzYznuN",
|
||||
"propertyGroupListID": "pglist-NyQzSSdEmo4YN8it-L2s0aqVYTavQVUe3-bRC1bJAxew1oGKjS-mtLl3jKQhzESRy5p",
|
||||
"backTestResult": {
|
||||
"task_id": "t4tlEfzYznuN",
|
||||
"start_time": "2025-12-07T00:45:25.34078659Z",
|
||||
"end_time": "2025-12-07T01:45:25.34078683Z",
|
||||
"performance": {
|
||||
"total_profit": 0.009399999999999999,
|
||||
"win_rate": 0.8333333333333334,
|
||||
"max_drawdown": 0.008,
|
||||
"calmar_ratio": 449.67,
|
||||
"sharpe_ratio": 31.2,
|
||||
"sqn": 1.6,
|
||||
"trades": 25,
|
||||
"profit_factor": 2.16,
|
||||
"expectancy": 0.75,
|
||||
"total_days": 0,
|
||||
"avg_trade_duration": 0,
|
||||
"cagr": 0.9843999999999999,
|
||||
"market_change": 0.0032,
|
||||
"best_pair": "WCT/USDT",
|
||||
"best_pair_profit": 0.004,
|
||||
"worst_pair": "TON/USDT",
|
||||
"worst_pair_profit": -0.0013
|
||||
},
|
||||
"full_hyperopt_event_id": "t4tlEfzYznuN",
|
||||
"parameters": {
|
||||
"add_bb_lower_proximity": "0.928",
|
||||
"add_position_callback": "0.051",
|
||||
"add_position_decrease_ratio": "0.61",
|
||||
"add_rsi_oversold_threshold": "21",
|
||||
"add_stochrsi_oversold": "14",
|
||||
"adjust_multiplier": "1.6",
|
||||
"bb_length": "22",
|
||||
"bb_lower_deviation": "1.038",
|
||||
"bb_std": "3.8",
|
||||
"bb_width_threshold": "0.019",
|
||||
"exit_bb_upper_deviation": "1.064",
|
||||
"exit_profit_tier1": "0.1",
|
||||
"exit_profit_tier2": "0.138",
|
||||
"exit_reduce_tier1": "0.42",
|
||||
"exit_reduce_tier2": "0.58",
|
||||
"exit_rsi_threshold": "69",
|
||||
"exit_volume_multiplier": "3.4",
|
||||
"h1_max_candles": "16",
|
||||
"h1_max_consecutive_candles": "1",
|
||||
"h1_rapid_rise_threshold": "0.128",
|
||||
"max_entry_adjustments": "4",
|
||||
"max_reduce_adjustments": "3",
|
||||
"min_condition_count": "1",
|
||||
"reduce_coefficient": "0.296",
|
||||
"reduce_profit_base": "0.033",
|
||||
"rsi_bull_threshold": "45",
|
||||
"rsi_length": "17",
|
||||
"rsi_oversold": "31",
|
||||
"stochrsi_bull_threshold": "22",
|
||||
"stochrsi_neutral_threshold": "26",
|
||||
"volume_multiplier": "5.8"
|
||||
},
|
||||
"type": "postTest",
|
||||
"property_group_list_id": ""
|
||||
},
|
||||
"backTestStartTime": "2025-10-17T00:00:00Z",
|
||||
"backTestEndTime": "2025-10-22T00:00:00Z"
|
||||
}
|
||||
19
jsons/best_performance.json
Normal file
19
jsons/best_performance.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"total_profit": 0.009399999999999999,
|
||||
"win_rate": 0.8333333333333334,
|
||||
"max_drawdown": 0.008,
|
||||
"calmar_ratio": 449.67,
|
||||
"sharpe_ratio": 31.2,
|
||||
"sqn": 1.6,
|
||||
"trades": 25,
|
||||
"profit_factor": 2.16,
|
||||
"expectancy": 0.75,
|
||||
"total_days": 0,
|
||||
"avg_trade_duration": 0,
|
||||
"cagr": 0.9843999999999999,
|
||||
"market_change": 0.0032,
|
||||
"best_pair": "WCT/USDT",
|
||||
"best_pair_profit": 0.004,
|
||||
"worst_pair": "TON/USDT",
|
||||
"worst_pair_profit": -0.0013
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user