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 | # strategy_breakout_trend_optimized.py # Breakout Trend Strategy v2 — 突破趋势 + 1h ATR动态止损 from freqtrade.strategy.interface import IStrategy from pandas import DataFrame import talib.abstract as ta import pandas as pd pd.options.mode.chained_assignment = None from functools import reduce from datetime import datetime import numpy as np from freqtrade.strategy import merge_informative_pair class BreakoutTrendStrategy(IStrategy): """ Breakout Trend Strategy v2 价格突破 + EMA趋势 + ADX强度 + 1h ATR动态止损 """ WHITELIST = ['BTC/USDT', 'ETH/USDT', 'BNB/USDT', 'SOL/USDT', 'XRP/USDT', 'DOGE/USDT', 'ADA/USDT', 'TRX/USDT', 'AVAX/USDT', 'LINK/USDT'] buy_params = { "ema_short": 20, "ema_long": 50, "adx_threshold": 22, "rsi_floor": 40, "rsi_ceiling": 75, "atr_period": 14, "atr_sl_multiplier": 3.0, "informative_timeframe": "1h", } sell_params = {} minimal_roi = { "0": 0.10, "60": 0.06, "120": 0.04, "240": 0.02, "480": 0 } stoploss = -0.08 timeframe = '5m' startup_candle_count = 200 process_only_new_candles = False trailing_stop = False use_exit_signal = False exit_profit_only = False ignore_roi_if_entry_signal = False use_custom_stoploss = True def informative_pairs(self): pairs = self.dp.current_whitelist() return [(pair, self.buy_params['informative_timeframe']) for pair in pairs] def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: informative = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe=self.buy_params['informative_timeframe']) informative['atr_1h'] = ta.ATR(informative, timeperiod=self.buy_params['atr_period']) dataframe = merge_informative_pair(dataframe, informative, self.timeframe, self.buy_params['informative_timeframe'], ffill=True) dataframe['ema_short'] = ta.EMA(dataframe, timeperiod=self.buy_params['ema_short']) dataframe['ema_long'] = ta.EMA(dataframe, timeperiod=self.buy_params['ema_long']) dataframe['adx'] = ta.ADX(dataframe, timeperiod=14) dataframe['plus_di'] = ta.PLUS_DI(dataframe, timeperiod=14) dataframe['minus_di'] = ta.MINUS_DI(dataframe, timeperiod=14) dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14) # 突破信号:价格突破N周期高点 dataframe['highest_20'] = dataframe['high'].rolling(window=20).max() dataframe['breakout'] = dataframe['close'] > dataframe['highest_20'].shift(1) return dataframe def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: conditions = [ dataframe['ema_short'] > dataframe['ema_long'], dataframe['adx'] > self.buy_params['adx_threshold'], dataframe['plus_di'] > dataframe['minus_di'], dataframe['breakout'], dataframe['rsi'] > self.buy_params['rsi_floor'], dataframe['rsi'] < self.buy_params['rsi_ceiling'], ] dataframe.loc[reduce(lambda x, y: x & y, conditions), 'enter_long'] = 1 return dataframe def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: return dataframe def custom_stoploss(self, pair: str, trade: 'Trade', current_time: datetime, current_rate: float, current_profit: float, **kwargs) -> float: dataframe, _ = self.dp.get_analyzed_dataframe(pair, self.timeframe) if len(dataframe) == 0: return self.stoploss last_candle = dataframe.iloc[-1].squeeze() atr = last_candle.get('atr_1h', 0) if atr <= 0: return self.stoploss sl_mult = self.buy_params['atr_sl_multiplier'] if current_profit > 0.10: trail_stop = (current_rate - atr * 1.0 - trade.open_rate) / trade.open_rate return max(trail_stop, self.stoploss) elif current_profit > 0.05: trail_stop = (current_rate - atr * 2.0 - trade.open_rate) / trade.open_rate return max(trail_stop, self.stoploss) elif current_profit > 0.02: return max(0.005, self.stoploss) else: base_stop = (current_rate - atr * sl_mult - trade.open_rate) / trade.open_rate return max(base_stop, self.stoploss) def custom_stake_amount(self, pair: str, current_time: datetime, current_rate: float, proposed_stake: float, min_stake: float, max_stake: float, entry_tag: str, **kwargs) -> float: dataframe, _ = self.dp.get_analyzed_dataframe(pair, self.timeframe) if len(dataframe) == 0: return proposed_stake last_candle = dataframe.iloc[-1].squeeze() risk_factor = 1.0 adx = last_candle.get('adx', 20) if adx > 30: risk_factor *= 1.3 elif adx < 18: risk_factor *= 0.7 risk_factor = max(0.3, min(1.5, risk_factor)) adjusted_stake = proposed_stake * risk_factor return max(min_stake, min(adjusted_stake, max_stake)) |
Strategy League — fixed backtest that feeds the ranking
Export report Freqtrade logsRun finished · took 785.3s
ℹ️ This strategy uses custom_stoploss() — freqtrade only
re-checks these once per 5m 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=0.98) — hard to tell apart from luck
- only 0% of resampled runs were profitable
- profitable in only 19% of rolling 3-month windows
- did not beat simply holding the market
- very deep drawdown (-94%)
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 |
|---|---|---|---|---|---|---|---|---|---|
| Nov 2022 | bearish trending high vol | 9 | -1.42 | -1.49 | 5 | 4 | 55.6 | -93.64 | 19h 08m |
| Oct 2022 | bullish choppy low vol | 34 | -1.60 | -0.44 | 19 | 15 | 55.9 | -93.27 | 21h 15m |
| Sep 2022 | bearish choppy high vol | 52 | +0.01 | 0.06 | 35 | 17 | 67.3 | -92.12 | 14h 05m |
| Aug 2022 | bullish choppy high vol | 48 | -3.81 | -0.74 | 30 | 18 | 62.5 | -92.36 | 13h 19m |
| Jul 2022 | bearish trending high vol | 63 | +0.19 | 0.01 | 45 | 18 | 71.4 | -90.74 | 10h 53m |
| Jun 2022 | bearish trending high vol | 77 | -5.92 | -0.79 | 41 | 36 | 53.2 | -89.6 | 9h 42m |
| May 2022 | bearish trending high vol | 133 | -9.40 | -0.60 | 77 | 56 | 57.9 | -86.37 | 9h 57m |
| Apr 2022 | bearish choppy high vol | 146 | -17.83 | -1.16 | 87 | 59 | 59.6 | -79.73 | 15h 36m |
| Mar 2022 | bullish choppy high vol | 183 | +3.12 | 0.15 | 128 | 55 | 69.9 | -73.91 | 13h 13m |
| Feb 2022 | bearish trending high vol | 214 | +1.12 | 0.04 | 150 | 64 | 70.1 | -74.9 | 10h 59m |
| Jan 2022 | bearish trending high vol | 230 | -10.50 | -0.44 | 142 | 88 | 61.7 | -71.72 | 11h 50m |
| Dec 2021 | bearish trending high vol | 296 | -15.80 | -0.51 | 186 | 110 | 62.8 | -68.62 | 11h 03m |
| Nov 2021 | bullish trending high vol | 396 | -12.96 | -0.29 | 253 | 143 | 63.9 | -56.5 | 12h 25m |
| Oct 2021 | bullish trending high vol | 393 | +6.83 | 0.16 | 269 | 124 | 68.4 | -50.6 | 12h 27m |
| Sep 2021 | bearish trending high vol | 500 | -13.99 | -0.26 | 326 | 174 | 65.2 | -51.77 | 9h 24m |
| Aug 2021 | bullish trending high vol | 482 | +15.63 | 0.33 | 348 | 134 | 72.2 | -53.73 | 10h 15m |
| Jul 2021 | bearish trending high vol | 370 | +6.79 | 0.11 | 254 | 116 | 68.6 | -64.04 | 10h 30m |
| Jun 2021 | bearish trending high vol | 470 | -29.24 | -0.60 | 287 | 183 | 61.1 | -59.32 | 8h 34m |
| May 2021 | bearish trending high vol | 852 | -47.70 | -0.53 | 522 | 330 | 61.3 | -43.25 | 5h 47m |
| Apr 2021 | bearish choppy high vol | 808 | +28.72 | 0.34 | 547 | 261 | 67.7 | -21.12 | 7h 14m |
| Mar 2021 | bullish choppy high vol | 662 | +5.64 | 0.09 | 432 | 230 | 65.3 | -29.34 | 9h 40m |
| Feb 2021 | bullish trending high vol | 863 | +6.30 | 0.02 | 555 | 308 | 64.3 | -27.42 | 6h 05m |
| Jan 2021 | bullish trending high vol | 927 | +5.86 | 0.09 | 583 | 344 | 62.9 | -22.54 | 5h 49m |
Yearly breakdown
| Year | Trades | Profit % | Avg % | Win | Loss | Win % | DD % | Avg dur |
|---|---|---|---|---|---|---|---|---|
| 2022 | 1189 | -46.04 | -0.37 | 759 | 430 | 63.8 | -93.64 | 12h 26m |
| 2021 | 7019 | -43.92 | -0.06 | 4562 | 2457 | 65.0 | -68.62 | 8h 20m |
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 patterns · 1 thing(s) worth reviewing before trusting the numbers
| Line | Pattern | Detail | |
|---|---|---|---|
| 48 | review | unthrottled_candle_processing | process_only_new_candles is False, so populate_indicators/populate_entry_trend/populate_exit_trend re-run every throttle_secs (default 5s) even though their inputs -- closed candles -- haven't changed since the last run. This wastes CPU without changing any value; if the goal is order-book-level checks, put that logic in confirm_trade_entry/custom_exit instead, which already run every loop |
ran by Ron · took s
Lookahead analysis
freqtrade lookahead-analysis: detects strategies peeking at future candles.