ml入场出场置信度阈值在hyperopt之后调整
This commit is contained in:
parent
790228fe61
commit
b19f769837
@ -1,10 +1,10 @@
|
||||
{
|
||||
"enable_strategy_log": false,
|
||||
"exchange": {
|
||||
"name": "okx",
|
||||
"key": "cbda9fde-b9e3-4a2d-94f9-e5c3705dfb5c",
|
||||
"secret": "CD3B7DB459CBBD540E0926E5C48150E1",
|
||||
"password": "c^-d:g;P2S9?Q#^",
|
||||
"enable_strategy_log": false,
|
||||
"enable_ws": false,
|
||||
"ccxt_config": {
|
||||
"enableRateLimit": true,
|
||||
|
||||
@ -18,22 +18,26 @@
|
||||
"add_position_callback": 0.043,
|
||||
"add_position_growth": 4.5,
|
||||
"add_position_multiplier": 1.15,
|
||||
"max_entry_adjustments": 4,
|
||||
"stake_divisor": 9.3,
|
||||
"bb_length": 30,
|
||||
"bb_lower_deviation": 1.01,
|
||||
"bb_std": 1.6,
|
||||
"bb_width_threshold": 0.016,
|
||||
"entry_interval_minutes": 42,
|
||||
"freqai_entry_up_percent": 0.5,
|
||||
"freqai_exit_down_percent": 0.5,
|
||||
"h1_max_candles": 213,
|
||||
"h1_max_consecutive_candles": 3,
|
||||
"h1_rapid_rise_threshold": 0.118,
|
||||
"max_entry_adjustments": 4,
|
||||
"min_condition_count": 3,
|
||||
"rsi_bull_threshold": 45,
|
||||
"rsi_length": 18,
|
||||
"rsi_oversold": 31,
|
||||
"stake_divisor": 9.3,
|
||||
"stochrsi_bull_threshold": 31,
|
||||
"stochrsi_neutral_threshold": 27,
|
||||
"volume_multiplier": 1.2
|
||||
"volume_multiplier": 1.2,
|
||||
"ml_entry_signal_threshold": 0.37
|
||||
},
|
||||
"sell": {
|
||||
"exit_bb_upper_deviation": 0.99,
|
||||
@ -41,10 +45,11 @@
|
||||
"roi_param_a": -6e-05,
|
||||
"roi_param_k": 108,
|
||||
"roi_param_t": 0.101,
|
||||
"rsi_overbought": 70
|
||||
"rsi_overbought": 70,
|
||||
"ml_exit_signal_threshold": 0.68
|
||||
},
|
||||
"protection": {}
|
||||
},
|
||||
"ft_stratparam_v": 1,
|
||||
"export_time": "2025-12-15 14:19:00.824138+00:00"
|
||||
"export_time": "2026-01-06 15:05:40.003677+00:00"
|
||||
}
|
||||
@ -203,41 +203,41 @@ class FreqaiPrimer(IStrategy):
|
||||
can_short = False # 禁用做空
|
||||
|
||||
# 自定义指标参数 - 使用Hyperopt可优化参数
|
||||
bb_length = IntParameter(10, 30, default=20, optimize=True, load=True, space='buy')
|
||||
bb_std = DecimalParameter(1.5, 3.0, decimals=1, default=2.0, optimize=True, load=True, space='buy')
|
||||
rsi_length = IntParameter(7, 21, default=14, optimize=True, load=True, space='buy')
|
||||
rsi_oversold = IntParameter(30, 50, default=42, optimize=True, load=True, space='buy')
|
||||
bb_length = IntParameter(10, 30, default=20, optimize=False, load=True, space='buy')
|
||||
bb_std = DecimalParameter(1.5, 3.0, decimals=1, default=2.0, optimize=False, load=True, space='buy')
|
||||
rsi_length = IntParameter(7, 21, default=14, optimize=False, load=True, space='buy')
|
||||
rsi_oversold = IntParameter(30, 50, default=42, optimize=False, load=True, space='buy')
|
||||
|
||||
|
||||
|
||||
# 入场条件阈值参数
|
||||
bb_lower_deviation = DecimalParameter(1.01, 1.05, decimals=2, default=1.03, optimize=True, load=True, space='buy')
|
||||
rsi_bull_threshold = IntParameter(45, 55, default=50, optimize=True, load=True, space='buy')
|
||||
stochrsi_bull_threshold = IntParameter(30, 40, default=35, optimize=True, load=True, space='buy')
|
||||
stochrsi_neutral_threshold = IntParameter(20, 30, default=25, optimize=True, load=True, space='buy')
|
||||
volume_multiplier = DecimalParameter(1.2, 2.0, decimals=1, default=1.5, optimize=True, load=True, space='buy')
|
||||
bb_width_threshold = DecimalParameter(0.01, 0.03, decimals=3, default=0.02, optimize=True, load=True, space='buy')
|
||||
min_condition_count = IntParameter(2, 4, default=3, optimize=True, load=True, space='buy')
|
||||
bb_lower_deviation = DecimalParameter(1.01, 1.05, decimals=2, default=1.03, optimize=False, load=True, space='buy')
|
||||
rsi_bull_threshold = IntParameter(45, 55, default=50, optimize=False, load=True, space='buy')
|
||||
stochrsi_bull_threshold = IntParameter(30, 40, default=35, optimize=False, load=True, space='buy')
|
||||
stochrsi_neutral_threshold = IntParameter(20, 30, default=25, optimize=False, load=True, space='buy')
|
||||
volume_multiplier = DecimalParameter(1.2, 2.0, decimals=1, default=1.5, optimize=False, load=True, space='buy')
|
||||
bb_width_threshold = DecimalParameter(0.01, 0.03, decimals=3, default=0.02, optimize=False, load=True, space='buy')
|
||||
min_condition_count = IntParameter(2, 4, default=3, optimize=False, load=True, space='buy')
|
||||
|
||||
# 剧烈拉升检测参数 - 使用Hyperopt可优化参数
|
||||
h1_max_candles = IntParameter(100, 300, default=200, optimize=True, load=True, space='buy')
|
||||
h1_rapid_rise_threshold = DecimalParameter(0.05, 0.15, decimals=3, default=0.11, optimize=True, load=True, space='buy')
|
||||
h1_max_consecutive_candles = IntParameter(1, 4, default=2, optimize=True, load=True, space='buy')
|
||||
h1_max_candles = IntParameter(100, 300, default=200, optimize=False, load=True, space='buy')
|
||||
h1_rapid_rise_threshold = DecimalParameter(0.05, 0.15, decimals=3, default=0.11, optimize=False, load=True, space='buy')
|
||||
h1_max_consecutive_candles = IntParameter(1, 4, default=2, optimize=False, load=True, space='buy')
|
||||
|
||||
# 入场间隔控制参数(分钟)
|
||||
entry_interval_minutes = IntParameter(20, 200, default=42, optimize=True, load=True, space='buy')
|
||||
entry_interval_minutes = IntParameter(20, 200, default=42, optimize=False, load=True, space='buy')
|
||||
|
||||
# ML 审核官:entry_signal 拒绝入场的阈值(越高越宽松,越低越严格)
|
||||
ml_entry_signal_threshold = DecimalParameter(0.05, 0.85, decimals=2, default=0.55, optimize=True, load=True, space='buy')
|
||||
|
||||
# ML 审核官:exit_signal 拒绝出场的阈值(越高越宽松,越低越严格)
|
||||
ml_exit_signal_threshold = DecimalParameter(0.05, 0.85, decimals=2, default=0.35, optimize=True, load=True, space='buy')
|
||||
ml_exit_signal_threshold = DecimalParameter(0.05, 0.85, decimals=2, default=0.35, optimize=True, load=True, space='sell')
|
||||
|
||||
# FreqAI 标签定义:entry_signal 的洛底上涨幅度(%)
|
||||
freqai_entry_up_percent = DecimalParameter(0.3, 2.0, decimals=2, default=0.5, optimize=True, load=True, space='buy')
|
||||
freqai_entry_up_percent = DecimalParameter(0.3, 2.0, decimals=2, default=0.5, optimize=False, load=True, space='buy')
|
||||
|
||||
# FreqAI 标签定义:exit_signal 的洛底下跌幅度(%)
|
||||
freqai_exit_down_percent = DecimalParameter(0.3, 2.0, decimals=2, default=0.5, optimize=True, load=True, space='buy')
|
||||
freqai_exit_down_percent = DecimalParameter(0.3, 2.0, decimals=2, default=0.5, optimize=False, load=True, space='buy')
|
||||
|
||||
# 定义可优化参数
|
||||
# 初始入场金额: 75.00
|
||||
@ -258,14 +258,14 @@ class FreqaiPrimer(IStrategy):
|
||||
stake_divisor = DecimalParameter(2.0, 12.0, decimals=2, default=9.3, optimize=False, load=True, space='buy') # 加仓金额分母(小数类型,保留2位小数)
|
||||
|
||||
# 线性ROI参数 - 用于线性函数: y = (a * (x + k)) + t
|
||||
roi_param_a = DecimalParameter(-0.0002, -0.00005, decimals=5, default=-0.0001, optimize=True, load=True, space='sell') # 系数a
|
||||
roi_param_k = IntParameter(20, 150, default=50, optimize=True, load=True, space='sell') # 偏移量k
|
||||
roi_param_t = DecimalParameter(0.02, 0.18, decimals=3, default=0.06, optimize=True, load=True, space='sell') # 常数项t
|
||||
roi_param_a = DecimalParameter(-0.0002, -0.00005, decimals=5, default=-0.0001, optimize=False, load=True, space='sell') # 系数a
|
||||
roi_param_k = IntParameter(20, 150, default=50, optimize=False, load=True, space='sell') # 偏移量k
|
||||
roi_param_t = DecimalParameter(0.02, 0.18, decimals=3, default=0.06, optimize=False, load=True, space='sell') # 常数项t
|
||||
# 出场条件阈值参数
|
||||
exit_bb_upper_deviation = DecimalParameter(0.98, 1.02, decimals=2, default=1.0, optimize=True, load=True, space='sell')
|
||||
exit_volume_multiplier = DecimalParameter(1.5, 3.0, decimals=1, default=2.0, optimize=True, load=True, space='sell')
|
||||
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(50, 70, default=58, optimize=True, load=True, space='sell')
|
||||
rsi_overbought = IntParameter(50, 70, default=58, optimize=False, load=True, space='sell')
|
||||
|
||||
|
||||
def informative_pairs(self):
|
||||
|
||||
@ -201,7 +201,6 @@ docker-compose run --rm freqtrade backtesting $PAIRS_FLAG \
|
||||
--logfile /freqtrade/user_data/logs/freqtrade.log \
|
||||
--freqaimodel LightGBMRegressorMultiTarget \
|
||||
--config /freqtrade/config_examples/$CONFIG_FILE \
|
||||
--config /freqtrade/config_examples/live.json \
|
||||
--config /freqtrade/templates/freqaiprimer.json \
|
||||
--strategy-path /freqtrade/templates \
|
||||
--enable-protections \
|
||||
|
||||
@ -382,7 +382,7 @@ elif [ -n "$PAIRS_ARG" ]; then
|
||||
echo "Using pairs from --pairs parameter: $PAIRS_ARG"
|
||||
else
|
||||
# 没有提供任何交易对参数,使用默认值
|
||||
DEFAULT_PAIRS="BTC/USDT TON/USDT DOT/USDT XRP/USDT OKB/USDT SOL/USDT DOGE/USDT RIO/USDT LTC/USDT SUI/USDT PEPE/USDT TRB/USDT FIL/USDT UNI/USDT KAITO/USDT"
|
||||
DEFAULT_PAIRS="DOT/USDT XRP/USDT SOL/USDT DOGE/USDT RIO/USDT LTC/USDT SUI/USDT PEPE/USDT TRB/USDT FIL/USDT UNI/USDT KAITO/USDT"
|
||||
PAIRS_FLAG="--pairs $DEFAULT_PAIRS"
|
||||
echo "No pairs parameter provided, using default pairs: $DEFAULT_PAIRS"
|
||||
fi
|
||||
@ -477,6 +477,7 @@ echo "docker-compose run --rm freqtrade hyperopt $PAIRS_FLAG \
|
||||
--freqaimodel LightGBMRegressorMultiTarget \
|
||||
--strategy $STRATEGY_CLASS_NAME \
|
||||
--config /freqtrade/config_examples/$CONFIG_FILE \
|
||||
--config /freqtrade/config_examples/hyperopt.json \
|
||||
--config /freqtrade/templates/${PARAMS_NAME}.json \
|
||||
--enable-protections \
|
||||
--strategy-path /freqtrade/templates \
|
||||
@ -494,8 +495,8 @@ docker-compose run --rm freqtrade hyperopt $PAIRS_FLAG \
|
||||
--strategy $STRATEGY_CLASS_NAME \
|
||||
--config /freqtrade/config_examples/$CONFIG_FILE \
|
||||
--config /freqtrade/templates/${PARAMS_NAME}.json \
|
||||
--config /freqtrade/config_examples/hyperopt.json \
|
||||
--enable-protections \
|
||||
--config /freqtrade/config_examples/hyperopt.json \
|
||||
--enable-protections \
|
||||
--strategy-path /freqtrade/templates \
|
||||
--timerange ${START_DATE}-${END_DATE} \
|
||||
--random-state $RANDOM_STATE \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user