protections
This commit is contained in:
parent
2bb31da591
commit
cdda03d666
@ -32,7 +32,34 @@ class FreqaiPrimer(IStrategy):
|
||||
super().__init__(config) # 调用父类的初始化方法并传递config
|
||||
# 存储从配置文件加载的默认值
|
||||
self._trailing_stop_positive_default = 0.004 # 降低默认值以更容易触发跟踪止盈
|
||||
|
||||
|
||||
@property
|
||||
def protections(self):
|
||||
"""
|
||||
保护机制配置
|
||||
基于最新Freqtrade规范,保护机制应定义在策略文件中而非配置文件
|
||||
"""
|
||||
return [
|
||||
{
|
||||
"method": "StoplossGuard",
|
||||
"lookback_period_candles": 60, # 3小时回看期(60根3分钟K线)
|
||||
"trade_limit": 2, # 最多2笔止损交易
|
||||
"stop_duration_candles": 60, # 暂停180分钟(60根3分钟K线)
|
||||
"only_per_pair": False # 仅针对单个币对
|
||||
},
|
||||
{
|
||||
"method": "CooldownPeriod",
|
||||
"stop_duration_candles": 2 # 6分钟冷却期(2根3分钟K线)
|
||||
},
|
||||
{
|
||||
"method": "MaxDrawdown",
|
||||
"lookback_period_candles": 48, # 2.4小时回看期
|
||||
"trade_limit": 4, # 4笔交易限制
|
||||
"stop_duration_candles": 24, # 72分钟暂停(24根3分钟K线)
|
||||
"max_allowed_drawdown": 0.20 # 20%最大回撤容忍度
|
||||
}
|
||||
]
|
||||
|
||||
@property
|
||||
def trailing_stop_positive(self):
|
||||
"""根据市场状态动态调整跟踪止盈参数"""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user