15 related strategies (⧉ identical code, ≈ similar name)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | # pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement # isort: skip_file """ Supertrend Futures V2 策略 - 优化版 改进点: 1. 适当放宽入场条件,增加交易机会 2. 添加 ADX 趋势强度 3. 优化做多做空信号 4. 动态杠杆管理 """ import numpy as np import pandas as pd from pandas import DataFrame from datetime import datetime from typing import Optional, Union from functools import reduce from freqtrade.strategy import IStrategy, DecimalParameter, IntParameter import talib.abstract as ta class SupertrendFuturesStrategyV2(IStrategy): """ Supertrend V2 - 合约优化版 支持做多和做空 """ INTERFACE_VERSION = 3 # 可优化参数 atr_period = IntParameter(10, 30, default=26, space="buy", optimize=True) atr_multiplier = DecimalParameter(2.0, 4.0, default=3.821, space="buy", optimize=True) ema_fast = IntParameter(5, 20, default=19, space="buy", optimize=True) ema_slow = IntParameter(20, 50, default=49, space="buy", optimize=True) adx_threshold = IntParameter(18, 30, default=24, space="buy", optimize=True) # 止盈 minimal_roi = { "0": 0.08, # 8% 即时止盈 } # 止损 stoploss = -0.07 # 7% (放宽止损) # 时间框架 timeframe = '15m' # 追踪止损 trailing_stop = True trailing_stop_positive = 0.025 trailing_stop_positive_offset = 0.035 trailing_only_offset_is_reached = True startup_candle_count = 200 order_types = { 'entry': 'limit', 'exit': 'limit', 'stoploss': 'market', 'stoploss_on_exchange': False } order_time_in_force = { 'entry': 'GTC', 'exit': 'GTC' } can_short: bool = True leverage_default = 2 use_exit_signal = True exit_profit_only = False def informative_pairs(self): return [] def supertrend(self, dataframe, period=14, multiplier=3): """计算 Supertrend 指标""" df = dataframe.copy() hl2 = (df['high'] + df['low']) / 2 atr = ta.ATR(df, timeperiod=period) upperband = hl2 + (multiplier * atr) lowerband = hl2 - (multiplier * atr) supertrend = [0] * len(df) direction = [1] * len(df) for i in range(1, len(df)): if df['close'].iloc[i] > upperband.iloc[i-1]: direction[i] = 1 elif df['close'].iloc[i] < lowerband.iloc[i-1]: direction[i] = -1 else: direction[i] = direction[i-1] if direction[i] == 1: supertrend[i] = lowerband.iloc[i] else: supertrend[i] = upperband.iloc[i] return pd.Series(supertrend, index=df.index), pd.Series(direction, index=df.index) def leverage(self, pair: str, current_time: datetime, current_rate: float, proposed_leverage: float, max_leverage: float, entry_tag: Optional[str], side: str, **kwargs) -> float: """动态杠杆 - 默认2x""" return min(self.leverage_default, max_leverage) def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: # EMA 趋势 dataframe['ema_fast'] = ta.EMA(dataframe, timeperiod=self.ema_fast.value) dataframe['ema_slow'] = ta.EMA(dataframe, timeperiod=self.ema_slow.value) # Supertrend dataframe['supertrend'], dataframe['st_dir'] = self.supertrend( dataframe, period=self.atr_period.value, multiplier=self.atr_multiplier.value ) # RSI dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14) # ADX dataframe['adx'] = ta.ADX(dataframe, timeperiod=14) # ATR dataframe['atr'] = ta.ATR(dataframe, timeperiod=14) # 成交量 dataframe['volume_ma'] = dataframe['volume'].rolling(20).mean() return dataframe def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: """做多信号""" dataframe.loc[:, 'enter_long'] = 0 conditions = [ # 1. Supertrend 看涨 dataframe['st_dir'] == 1, # 2. EMA 多头 dataframe['ema_fast'] > dataframe['ema_slow'], # 3. ADX > 20 (趋势存在) dataframe['adx'] > self.adx_threshold.value, # 4. RSI < 70 dataframe['rsi'] < 70, # 5. 成交量 > 平均 (放宽) dataframe['volume'] > dataframe['volume_ma'], # 6. 价格在 Supertrend 之上 dataframe['close'] > dataframe['supertrend'], ] if conditions: dataframe.loc[reduce(lambda x, y: x & y, conditions), 'enter_long'] = 1 return dataframe def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: """做多平仓""" dataframe.loc[:, 'exit_long'] = 0 conditions = [ dataframe['st_dir'] == -1, ] if conditions: dataframe.loc[reduce(lambda x, y: x & y, conditions), 'exit_long'] = 1 return dataframe def populate_entry_trend_short(self, dataframe: DataFrame, metadata: dict) -> DataFrame: """做空信号""" dataframe.loc[:, 'enter_short'] = 0 conditions = [ # 1. Supertrend 看空 dataframe['st_dir'] == -1, # 2. EMA 空头 dataframe['ema_fast'] < dataframe['ema_slow'], # 3. ADX > 20 dataframe['adx'] > self.adx_threshold.value, # 4. RSI > 30 dataframe['rsi'] > 30, # 5. 成交量 > 平均 dataframe['volume'] > dataframe['volume_ma'], # 6. 价格在 Supertrend 之下 dataframe['close'] < dataframe['supertrend'], ] if conditions: dataframe.loc[reduce(lambda x, y: x & y, conditions), 'enter_short'] = 1 return dataframe def populate_exit_trend_short(self, dataframe: DataFrame, metadata: dict) -> DataFrame: """做空平仓""" dataframe.loc[:, 'exit_short'] = 0 conditions = [ dataframe['st_dir'] == 1, ] if conditions: dataframe.loc[reduce(lambda x, y: x & y, conditions), 'exit_short'] = 1 return dataframe |
Strategy League — fixed backtest that feeds the ranking
Export report Freqtrade logsRun finished · took 412.6s
ℹ️ This strategy uses a trailing stop — freqtrade only
re-checks these once per 15m candle by default, not against the price movement within it.
For a more accurate read, re-run this backtest locally with --timeframe-detail 1m. Freqle doesn't do this for every check here: multiplying every
League/sweep backtest by a finer detail timeframe is more compute than the sandbox can sustain
across every indexed strategy. why this matters →
- profit isn't statistically significant (p=1.00) — hard to tell apart from luck
- only 0% of resampled runs were profitable
- profitable in only 0% of rolling 3-month windows
- did not beat simply holding the market
- very deep drawdown (-91%)
Resampling the trade sequence 2,000× shows the spread of results this edge could plausibly produce — separating a dependable strategy from one that got lucky once.
Loading charts…
Monthly breakdown
| Month | Regime | Trades | Profit % | Avg % | Win | Loss | Win % | DD % | Avg dur |
|---|---|---|---|---|---|---|---|---|---|
| Apr 2021 | bearish choppy high vol | 57 | -3.74 | -0.65 | 37 | 20 | 64.9 | -91.39 | 2h 14m |
| Mar 2021 | bullish choppy high vol | 196 | -14.86 | -0.77 | 121 | 75 | 61.7 | -90.79 | 4h 14m |
| Feb 2021 | bullish trending high vol | 872 | -15.72 | -0.17 | 576 | 296 | 66.1 | -75.35 | 1h 39m |
| Jan 2021 | bullish trending high vol | 1428 | -55.69 | -0.40 | 919 | 509 | 64.4 | -68.09 | 1h 38m |
Trade charts — best 2 and worst 2 performing pairs (full OHLC candles are expensive to render for every pair)
Backtests — over a market period
Backtest this strategy over a chosen crypto-cycle period. These don't affect the League ranking, and need that period's candle data downloaded.
Log in or sign up to run backtests.
| Period | Range | Total % | Win % | Max DD | Trades | |
|---|---|---|---|---|---|---|
| 2020 · DeFi Summer & Pre-Halving Rally | 20200101-20210101 | not run | ||||
| 2021 · Institutional Bull Market | 20210101-20220101 | not run | ||||
| 2022 · Post-Bull Crash & Macro Tightening | 20220101-20230101 | not run | ||||
| 2023–2024 · Recovery & ETF Anticipation | 20230101-20250101 | not run | ||||
| 2025–2026 · Current Cycle | 20250101-20260101 | not run | ||||
Walk forward
Out-of-sample backtest on recent data · 33 pairs · 20260101-20260701.
Backtest trust check
no lookahead-bias patterns detected
ran by Ron · took s
Lookahead analysis
freqtrade lookahead-analysis: detects strategies peeking at future candles.