加入了protection
This commit is contained in:
parent
8d479752ee
commit
184425b1de
@ -6,11 +6,49 @@ from freqtrade.persistence import Trade
|
||||
from datetime import datetime
|
||||
|
||||
class TheForceV7(IStrategy):
|
||||
# Strategy configuration
|
||||
timeframe = "5m"
|
||||
minimal_roi = {"0": 0.02} # 2% ROI for realistic take-profit
|
||||
stoploss = -0.1 # Fallback, overridden by custom_exit
|
||||
startup_candle_count = 200 # Reduced for indicator calculations
|
||||
# 基础参数
|
||||
timeframe = '5m'
|
||||
stoploss = -0.14 # 全局止损
|
||||
use_exit_signal = True
|
||||
exit_profit_only = False
|
||||
ignore_roi_if_entry_signal = False
|
||||
|
||||
@property
|
||||
def protections(self):
|
||||
return [
|
||||
{
|
||||
"method": "CooldownPeriod",
|
||||
"stop_duration_candles": 5 # 卖出后禁止再次买入的K线数
|
||||
},
|
||||
{
|
||||
"method": "MaxDrawdown",
|
||||
"lookback_period_candles": 48,
|
||||
"trade_limit": 20,
|
||||
"stop_duration_candles": 4,
|
||||
"max_allowed_drawdown": 0.2 # 最大允许回撤 20%
|
||||
},
|
||||
{
|
||||
"method": "StoplossGuard",
|
||||
"lookback_period_candles": 24,
|
||||
"trade_limit": 4, # 在 lookback 内最多触发几次止损
|
||||
"stop_duration_candles": 2, # 锁定多少根 K 线
|
||||
"only_per_pair": False # 是否按币种统计
|
||||
},
|
||||
{
|
||||
"method": "LowProfitPairs",
|
||||
"lookback_period_candles": 6,
|
||||
"trade_limit": 2,
|
||||
"stop_duration_candles": 60,
|
||||
"required_profit": 0.02 # 最低平均收益 2%
|
||||
},
|
||||
{
|
||||
"method": "LowProfitPairs",
|
||||
"lookback_period_candles": 24,
|
||||
"trade_limit": 4,
|
||||
"stop_duration_candles": 2,
|
||||
"required_profit": 0.01 # 最低平均收益 1%
|
||||
}
|
||||
]
|
||||
|
||||
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||
dataframe['ema200c'] = ta.EMA(dataframe['close'], timeperiod=200)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user