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 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | from datetime import datetime, timedelta import requests import talib.abstract as ta import pandas_ta as pta from freqtrade.persistence import Trade from freqtrade.strategy.interface import IStrategy from pandas import DataFrame from freqtrade.strategy import DecimalParameter, IntParameter from functools import reduce import warnings from typing import Dict, Optional, Union, Tuple import logging warnings.simplefilter(action="ignore", category=RuntimeWarning) TMP_HOLD = [] TMP_HOLD1 = [] logger = logging.getLogger(__name__) class E0V1EN(IStrategy): minimal_roi = { "0": 1 } timeframe = '5m' process_only_new_candles = True startup_candle_count = 240 order_types = { 'entry': 'market', 'exit': 'market', 'emergency_exit': 'market', 'force_entry': 'market', 'force_exit': "market", 'stoploss': 'market', 'stoploss_on_exchange': False, 'stoploss_on_exchange_interval': 60, 'stoploss_on_exchange_market_ratio': 0.99 } slippage_protection = { 'retries': 3, 'max_slippage': -0.02 } cc = {} # current_candle = {} stoploss = -0.25 trailing_stop = False trailing_stop_positive = 0.002 trailing_stop_positive_offset = 0.05 trailing_only_offset_is_reached = True use_custom_stoploss = True is_optimize_32 = True buy_rsi_fast_32 = IntParameter(20, 70, default=40, space='buy', optimize=is_optimize_32) buy_rsi_32 = IntParameter(15, 50, default=42, space='buy', optimize=is_optimize_32) buy_sma15_32 = DecimalParameter(0.900, 1, default=0.973, decimals=3, space='buy', optimize=is_optimize_32) buy_cti_32 = DecimalParameter(-1, 1, default=0.69, decimals=2, space='buy', optimize=is_optimize_32) sell_fastx = IntParameter(50, 100, default=84, space='sell', optimize=True) cci_opt = True sell_loss_cci = IntParameter(low=0, high=600, default=120, space='sell', optimize=cci_opt) sell_loss_cci_profit = DecimalParameter(-0.15, 0, default=-0.05, decimals=2, space='sell', optimize=cci_opt) buy_rsi_period = IntParameter(10, 190, default=20, space="buy") buy_rsi_fast_period = IntParameter(10, 190, default=10, space="buy") buy_rsi_slow_period = IntParameter(10, 190, default=40, space="buy") buy_sma_period = IntParameter(10, 190, default=15, space="buy") # --- 企业微信 Webhook(替换为你自己的key)--- def _send_wecom(self, content: str) -> None: webhook_url = "**************************************************************************8" headers = {"Content-Type": "application/json"} data = {"msgtype": "markdown", "markdown": {"content": content}} try: response = requests.post(webhook_url, json=data, headers=headers, timeout=10) logger.info(f"WeCom response: {response.json()}") except Exception as e: logger.error(f"Failed to send WeCom message: {e}") @property def protections(self): return [ { "method": "LowProfitPairs", "lookback_period_candles": 60, "trade_limit": 1, "stop_duration_candles": 60, "required_profit": -0.05 }, { "method": "CooldownPeriod", "stop_duration_candles": 5 } ] def custom_stoploss(self, pair: str, trade: Trade, current_time: datetime, current_rate: float, current_profit: float, **kwargs) -> float: if current_profit >= 0.05: return -0.002 if str(trade.enter_tag) == "buy_new" and current_profit >= 0.03: return -0.003 return None def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: # buy_1 indicators buy_sma15_32 = 2 - self.buy_sma15_32.value dataframe["sma_15"] = ta.SMA( dataframe, timeperiod=int(self.buy_sma_period.value) ) dataframe['sma_15_a'] = dataframe['sma_15'] * buy_sma15_32 dataframe['sma_15_b'] = dataframe['sma_15'] * self.buy_sma15_32.value dataframe["cti"] = pta.cti(dataframe["close"], length=20) dataframe["rsi"] = ta.RSI(dataframe, timeperiod=int(self.buy_rsi_period.value)) dataframe["rsi_fast"] = ta.RSI( dataframe, timeperiod=int(self.buy_rsi_fast_period.value) ) dataframe["rsi_slow"] = ta.RSI( dataframe, timeperiod=int(self.buy_rsi_slow_period.value) ) # profit sell indicators stoch_fast = ta.STOCHF(dataframe, 5, 3, 0, 3, 0) dataframe['fastk'] = stoch_fast['fastk'] dataframe['cci'] = ta.CCI(dataframe, timeperiod=20) dataframe['ma120'] = ta.MA(dataframe, timeperiod=120) dataframe['ma240'] = ta.MA(dataframe, timeperiod=240) # my add dataframe['change'] = (100 / dataframe['open'] * dataframe['close'] - 100) return dataframe def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: conditions = [] dataframe.loc[:, 'enter_tag'] = '' buy_1 = ( (dataframe['rsi_slow'] < dataframe['rsi_slow'].shift(1)) & (dataframe['rsi_fast'] < self.buy_rsi_fast_32.value) & (dataframe['rsi'] > self.buy_rsi_32.value) & (dataframe['close'] < dataframe['sma_15'] * self.buy_sma15_32.value) & (dataframe['cti'] < self.buy_cti_32.value) ) # buy_new = ( # (dataframe['rsi_slow'] < dataframe['rsi_slow'].shift(1)) & # (dataframe['rsi_fast'] < 34) & # (dataframe['rsi'] > 28) & # (dataframe['close'] < dataframe['sma_15'] * 0.96) & # (dataframe['cti'] < self.buy_cti_32.value) # ) conditions.append(buy_1) dataframe.loc[buy_1, 'enter_tag'] += 'buy_1' # conditions.append(buy_new) # dataframe.loc[buy_new, 'enter_tag'] += 'buy_new' if conditions: dataframe.loc[ reduce(lambda x, y: x | y, conditions), 'enter_long'] = 1 return dataframe def confirm_trade_entry(self, pair: str, order_type: str, amount: float, rate: float, time_in_force: str, current_time: datetime, entry_tag: Optional[str], side: str, **kwargs) -> bool: trade_hist = Trade.get_trades_proxy(is_open=False, close_date=current_time - timedelta(hours=int(current_time.strftime("%H"))) - timedelta(minutes=int(current_time.strftime("%M")))) profit = 0 for t in trade_hist: profit = profit + t.close_profit if profit >= 0.05: return False msg = ( f"**QuickSignal 买入**\n" f"交易对: {pair}\n" f"价格: {rate:.2f}\n" f"时间: {current_time.strftime('%Y-%m-%d %H:%M:%S')}" ) self._send_wecom(msg) return True def custom_exit(self, pair: str, trade: 'Trade', current_time: 'datetime', current_rate: float, current_profit: float, **kwargs): dataframe, _ = self.dp.get_analyzed_dataframe(pair=pair, timeframe=self.timeframe) current_candle = dataframe.iloc[-1].squeeze() min_profit = trade.calc_profit_ratio(trade.min_rate) if self.config['runmode'].value in ('live', 'dry_run'): state = self.cc pc = state.get(trade.id, {'date': current_candle['date'], 'open': current_candle['close'], 'high': current_candle['close'], 'low': current_candle['close'], 'close': current_rate, 'volume': 0}) if current_candle['date'] != pc['date']: pc['date'] = current_candle['date'] pc['high'] = current_candle['close'] pc['low'] = current_candle['close'] pc['open'] = current_candle['close'] pc['close'] = current_rate if current_rate > pc['high']: pc['high'] = current_rate if current_rate < pc['low']: pc['low'] = current_rate if current_rate != pc['close']: pc['close'] = current_rate state[trade.id] = pc if trade.id not in TMP_HOLD: if len(dataframe.loc[dataframe['date'] < trade.open_date_utc]) > 0: open_candle = dataframe.loc[dataframe['date'] < trade.open_date_utc].iloc[-1].squeeze() if open_candle['close'] > open_candle["ma120"] and open_candle['close'] > open_candle["ma240"]: TMP_HOLD.append(trade.id) elif current_candle['close'] > current_candle["ma120"] and current_candle['close'] > current_candle["ma240"]: TMP_HOLD.append(trade.id) if trade.id not in TMP_HOLD1: if (trade.open_rate - current_candle["ma120"]) / trade.open_rate >= 0.1: TMP_HOLD1.append(trade.id) if current_profit > 0: if self.config['runmode'].value in ('live', 'dry_run'): if current_time > pc['date'] + timedelta(minutes=9) + timedelta(seconds=55): df = dataframe.copy() df = df._append(pc, ignore_index = True) stoch_fast = ta.STOCHF(df, 5, 3, 0, 3, 0) df['fastk'] = stoch_fast['fastk'] cc = df.iloc[-1].squeeze() if cc["fastk"] > self.sell_fastx.value: return "fastk_profit_sell_2" else: if current_candle["fastk"] > self.sell_fastx.value: return "fastk_profit_sell" else: if current_candle["fastk"] > self.sell_fastx.value: return "fastk_profit_sell" if min_profit <= -0.1: if current_profit > self.sell_loss_cci_profit.value: if current_candle["cci"] > self.sell_loss_cci.value: return "cci_loss_sell" if trade.id in TMP_HOLD1 and current_candle["close"] < current_candle["ma120"]: TMP_HOLD1.remove(trade.id) return "ma120_sell_fast" if trade.id in TMP_HOLD and current_candle["close"] < current_candle["ma120"] and current_candle["close"] < current_candle["ma240"]: if min_profit <= -0.1: TMP_HOLD.remove(trade.id) return "ma120_sell" return None def confirm_trade_exit(self, pair: str, trade, order_type: str, amount: float, rate: float, time_in_force: str, exit_reason: str, current_time: datetime, **kwargs) -> bool: profit_pct = ((rate - trade.open_rate) / trade.open_rate) * 100 msg = ( f"**QuickSignal 卖出**\n" f"交易对: {pair}\n" f"价格: {rate:.2f}\n" f"盈亏: {profit_pct:.2f}%\n" f"原因: {exit_reason}\n" f"时间: {current_time.strftime('%Y-%m-%d %H:%M:%S')}" ) self._send_wecom(msg) return True def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: dataframe.loc[:, ['exit_long', 'exit_tag']] = (0, 'long_out') return dataframe |
Strategy League — fixed backtest that feeds the ranking
Export report Freqtrade logsRun finished · took 452.9s
ℹ️ This strategy uses a trailing stop / 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.18) — hard to tell apart from luck
- did not beat simply holding the market
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 |
|---|---|---|---|---|---|---|---|---|---|
| Dec 2025 | bearish trending low vol | 3 | +0.37 | 1.23 | 3 | 0 | 100.0 | -8.87 | 0h 45m |
| Nov 2025 | bearish trending high vol | 27 | -0.68 | -0.25 | 21 | 6 | 77.8 | -9.65 | 3h 08m |
| Oct 2025 | bearish trending low vol | 16 | -0.48 | -0.30 | 14 | 2 | 87.5 | -8.39 | 2h 02m |
| Sep 2025 | bullish choppy low vol | 7 | -0.34 | -0.48 | 6 | 1 | 85.7 | -8.56 | 2h 54m |
| Aug 2025 | bullish choppy low vol | 3 | -0.93 | -3.09 | 2 | 1 | 66.7 | -7.75 | 17h 10m |
| Jul 2025 | bullish choppy low vol | 4 | +0.28 | 0.70 | 4 | 0 | 100.0 | -7.21 | 0h 34m |
| Jun 2025 | bearish choppy low vol | 3 | -0.46 | -1.52 | 2 | 1 | 66.7 | -7.22 | 15h 58m |
| May 2025 | bullish trending low vol | 4 | +0.88 | 2.20 | 4 | 0 | 100.0 | -7.38 | 1h 04m |
| Apr 2025 | bullish choppy low vol | 2 | -0.71 | -3.54 | 1 | 1 | 50.0 | -7.59 | 1h 28m |
| Mar 2025 | bearish trending high vol | 4 | -0.71 | -1.78 | 3 | 1 | 75.0 | -6.99 | 2h 18m |
| Feb 2025 | bearish trending low vol | 9 | -0.12 | -0.13 | 8 | 1 | 88.9 | -6.43 | 3h 19m |
| Jan 2025 | bearish choppy low vol | 4 | +0.38 | 0.96 | 4 | 0 | 100.0 | -6.63 | 0h 22m |
| Dec 2024 | bullish trending low vol | 34 | +0.86 | 0.25 | 31 | 3 | 91.2 | -7.5 | 2h 29m |
| Nov 2024 | bullish trending low vol | 63 | +8.34 | 1.32 | 62 | 1 | 98.4 | -13.86 | 1h 34m |
| Sep 2024 | bearish choppy low vol | 2 | +0.16 | 0.82 | 2 | 0 | 100.0 | -14.07 | 0h 20m |
| Aug 2024 | bearish choppy high vol | 3 | +0.24 | 0.79 | 3 | 0 | 100.0 | -14.22 | 2h 12m |
| Jun 2024 | bearish choppy low vol | 1 | +0.01 | 0.13 | 1 | 0 | 100.0 | -14.3 | 0h 55m |
| May 2024 | bullish choppy high vol | 3 | -0.05 | -0.17 | 2 | 1 | 66.7 | -14.54 | 15h 43m |
| Apr 2024 | bearish choppy high vol | 6 | -1.05 | -1.75 | 5 | 1 | 83.3 | -14.27 | 0h 55m |
| Mar 2024 | bullish trending high vol | 28 | +1.46 | 0.52 | 25 | 3 | 89.3 | -14.69 | 2h 25m |
| Feb 2024 | bullish trending low vol | 13 | +2.10 | 1.61 | 13 | 0 | 100.0 | -16.01 | 0h 45m |
| Jan 2024 | bearish choppy high vol | 9 | +0.11 | 0.12 | 8 | 1 | 88.9 | -16.88 | 2h 38m |
| Dec 2023 | bullish trending low vol | 27 | +0.54 | 0.20 | 24 | 3 | 88.9 | -17.05 | 2h 49m |
| Nov 2023 | bullish trending low vol | 14 | +1.41 | 1.01 | 14 | 0 | 100.0 | -17.9 | 1h 06m |
| Oct 2023 | bullish trending low vol | 4 | +0.33 | 0.82 | 4 | 0 | 100.0 | -18.11 | 2h 50m |
| Aug 2023 | bearish choppy low vol | 8 | -2.64 | -3.29 | 5 | 3 | 62.5 | -18.29 | 3h 20m |
| Jul 2023 | bullish trending low vol | 11 | -0.06 | -0.05 | 9 | 2 | 81.8 | -16.45 | 2h 34m |
| Jun 2023 | bullish trending low vol | 11 | +1.67 | 1.52 | 11 | 0 | 100.0 | -17.27 | 2h 35m |
| Apr 2023 | bullish trending low vol | 2 | +0.13 | 0.66 | 2 | 0 | 100.0 | -17.37 | 1h 50m |
| Mar 2023 | bullish trending high vol | 4 | +0.43 | 1.07 | 4 | 0 | 100.0 | -17.74 | 0h 42m |
| Feb 2023 | bullish trending low vol | 6 | +0.78 | 1.30 | 6 | 0 | 100.0 | -18.32 | 1h 33m |
| Jan 2023 | bullish trending low vol | 18 | +1.51 | 0.84 | 18 | 0 | 100.0 | -19.62 | 5h 59m |
| Nov 2022 | bearish trending high vol | 32 | -11.10 | -3.47 | 22 | 10 | 68.8 | -21.23 | 3h 31m |
| Oct 2022 | bullish choppy low vol | 11 | +0.29 | 0.26 | 10 | 1 | 90.9 | -10.95 | 1h 20m |
| Sep 2022 | bearish choppy high vol | 5 | -0.62 | -1.24 | 4 | 1 | 80.0 | -11.26 | 7h 31m |
| Aug 2022 | bullish choppy high vol | 14 | -0.66 | -0.47 | 12 | 2 | 85.7 | -10.6 | 2h 50m |
| Jul 2022 | bearish trending high vol | 13 | +2.23 | 1.71 | 13 | 0 | 100.0 | -11.67 | 0h 48m |
| Jun 2022 | bearish trending high vol | 29 | +4.84 | 1.67 | 28 | 1 | 96.6 | -15.6 | 2h 11m |
| May 2022 | bearish trending high vol | 67 | -17.74 | -2.65 | 44 | 23 | 65.7 | -18.44 | 3h 52m |
| Apr 2022 | bearish choppy high vol | 8 | -0.29 | -0.36 | 7 | 1 | 87.5 | -1.77 | 1h 52m |
| Mar 2022 | bullish choppy high vol | 4 | +0.42 | 1.04 | 4 | 0 | 100.0 | -1.42 | 1h 44m |
| Feb 2022 | bearish trending high vol | 9 | +2.80 | 3.11 | 9 | 0 | 100.0 | -3.79 | 26h 16m |
| Jan 2022 | bearish trending high vol | 19 | -1.80 | -0.94 | 15 | 4 | 78.9 | -3.88 | 11h 55m |
| Dec 2021 | bearish trending high vol | 9 | +0.57 | 0.64 | 8 | 1 | 88.9 | -2.93 | 1h 06m |
| Nov 2021 | bullish trending high vol | 7 | +0.56 | 0.80 | 7 | 0 | 100.0 | -3.25 | 1h 06m |
| Oct 2021 | bullish trending high vol | 11 | -0.65 | -0.60 | 9 | 2 | 81.8 | -3.84 | 2h 10m |
| Sep 2021 | bearish trending high vol | 38 | +1.37 | 0.36 | 34 | 4 | 89.5 | -4.03 | 2h 00m |
| Aug 2021 | bullish trending high vol | 25 | +2.25 | 0.90 | 23 | 2 | 92.0 | -5.37 | 3h 41m |
| Jul 2021 | bearish trending high vol | 8 | +0.90 | 1.13 | 8 | 0 | 100.0 | -6.26 | 6h 18m |
| Jun 2021 | bearish trending high vol | 32 | +0.53 | 0.16 | 29 | 3 | 90.6 | -8.3 | 2h 44m |
| May 2021 | bearish trending high vol | 167 | -1.90 | -0.11 | 130 | 37 | 77.8 | -12.09 | 2h 05m |
| Apr 2021 | bearish choppy high vol | 73 | +9.69 | 1.33 | 68 | 5 | 93.2 | -2.42 | 1h 48m |
| Mar 2021 | bullish choppy high vol | 39 | +0.80 | 0.21 | 35 | 4 | 89.7 | -2.52 | 3h 33m |
| Feb 2021 | bullish trending high vol | 145 | +6.95 | 0.48 | 129 | 16 | 89.0 | -6.25 | 2h 02m |
| Jan 2021 | bullish trending high vol | 151 | +1.32 | 0.09 | 128 | 23 | 84.8 | -4.33 | 1h 54m |
Yearly breakdown
| Year | Trades | Profit % | Avg % | Win | Loss | Win % | DD % | Avg dur |
|---|---|---|---|---|---|---|---|---|
| 2025 | 86 | -2.52 | -0.29 | 72 | 14 | 83.7 | -9.65 | 3h 22m |
| 2024 | 162 | +12.18 | 0.75 | 152 | 10 | 93.8 | -16.88 | 2h 08m |
| 2023 | 105 | +4.10 | 0.39 | 97 | 8 | 92.4 | -19.62 | 2h 57m |
| 2022 | 211 | -21.63 | -1.03 | 168 | 43 | 79.6 | -21.23 | 4h 51m |
| 2021 | 705 | +22.39 | 0.32 | 608 | 97 | 86.2 | -12.09 | 2h 12m |
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 | |
|---|---|---|---|
| 141 | review | enter_tag_overwrite | enter_tag/exit_tag is written by 2 separate assignments -- they share one column and run in source order, so a row matching more than one condition keeps only the LAST tag. Per-tag statistics won't mean what they appear to |
ran by Ron · took s
Lookahead analysis
freqtrade lookahead-analysis: detects strategies peeking at future candles.