6 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 | from datetime import datetime from pandas import DataFrame import talib.abstract as ta from freqtrade.strategy import DecimalParameter, IStrategy, IntParameter, informative class BearMarketShortV2(IStrategy): """BTC-only research strategy for bear-market short setups. The strategy is deliberately not an always-on short bot. It looks for a bearish BTC regime, then waits for either a retest rejection or a controlled breakdown. It is meant for backtesting and dry-run research only. """ INTERFACE_VERSION = 3 can_short = True timeframe = "15m" startup_candle_count = 420 process_only_new_candles = True position_adjustment_enable = False max_entry_position_adjustment = 0 minimal_roi = { "0": 0.055, "180": 0.028, "480": 0.0, } stoploss = -0.055 trailing_stop = True trailing_stop_positive = 0.014 trailing_stop_positive_offset = 0.034 trailing_only_offset_is_reached = True use_exit_signal = True exit_profit_only = False ignore_roi_if_entry_signal = False adx_min = IntParameter(18, 35, default=23, space="buy", optimize=False) rsi_min = IntParameter(24, 40, default=31, space="buy", optimize=False) rsi_max = IntParameter(45, 62, default=55, space="buy", optimize=False) daily_rsi_min = IntParameter(24, 40, default=31, space="buy", optimize=False) daily_rsi_max = IntParameter(42, 58, default=52, space="buy", optimize=False) max_daily_ema50_atr_extension = DecimalParameter(1.0, 4.0, default=2.4, decimals=1, space="buy", optimize=False) max_15m_ema50_atr_extension = DecimalParameter(0.8, 3.0, default=1.7, decimals=1, space="buy", optimize=False) min_volume_factor = DecimalParameter(0.3, 1.5, default=0.65, decimals=2, space="buy", optimize=False) retest_buffer = DecimalParameter(0.000, 0.010, default=0.003, decimals=3, space="buy", optimize=False) ema50_exit_buffer = DecimalParameter(0.000, 0.012, default=0.004, decimals=3, space="sell", optimize=False) profit_take_rsi = IntParameter(18, 35, default=26, space="sell", optimize=False) @property def protections(self) -> list[dict]: return [ { "method": "CooldownPeriod", "stop_duration_candles": 3, }, { "method": "StoplossGuard", "lookback_period_candles": 72, "trade_limit": 2, "stop_duration_candles": 16, "required_profit": 0.0, "only_per_pair": False, "only_per_side": True, }, { "method": "MaxDrawdown", "calculation_mode": "equity", "lookback_period_candles": 144, "trade_limit": 8, "stop_duration_candles": 24, "max_allowed_drawdown": 0.08, }, ] @staticmethod def _is_btc_pair(pair: str) -> bool: return pair.upper().startswith("BTC/") @informative("1h") def populate_indicators_1h(self, dataframe: DataFrame, metadata: dict) -> DataFrame: dataframe["ema_20"] = ta.EMA(dataframe, timeperiod=20) dataframe["ema_50"] = ta.EMA(dataframe, timeperiod=50) dataframe["ema_200"] = ta.EMA(dataframe, timeperiod=200) dataframe["rsi"] = ta.RSI(dataframe, timeperiod=14) dataframe["adx"] = ta.ADX(dataframe, timeperiod=14) dataframe["atr"] = ta.ATR(dataframe, timeperiod=14) dataframe["plus_di"] = ta.PLUS_DI(dataframe, timeperiod=14) dataframe["minus_di"] = ta.MINUS_DI(dataframe, timeperiod=14) dataframe["ema_50_slope"] = dataframe["ema_50"] - dataframe["ema_50"].shift(6) return dataframe @informative("4h") def populate_indicators_4h(self, dataframe: DataFrame, metadata: dict) -> DataFrame: dataframe["ema_20"] = ta.EMA(dataframe, timeperiod=20) dataframe["ema_50"] = ta.EMA(dataframe, timeperiod=50) dataframe["ema_200"] = ta.EMA(dataframe, timeperiod=200) dataframe["rsi"] = ta.RSI(dataframe, timeperiod=14) dataframe["adx"] = ta.ADX(dataframe, timeperiod=14) dataframe["atr"] = ta.ATR(dataframe, timeperiod=14) dataframe["plus_di"] = ta.PLUS_DI(dataframe, timeperiod=14) dataframe["minus_di"] = ta.MINUS_DI(dataframe, timeperiod=14) dataframe["ema_50_slope"] = dataframe["ema_50"] - dataframe["ema_50"].shift(4) return dataframe @informative("1d") def populate_indicators_1d(self, dataframe: DataFrame, metadata: dict) -> DataFrame: dataframe["ema_20"] = ta.EMA(dataframe, timeperiod=20) dataframe["ema_50"] = ta.EMA(dataframe, timeperiod=50) dataframe["ema_200"] = ta.EMA(dataframe, timeperiod=200) dataframe["rsi"] = ta.RSI(dataframe, timeperiod=14) dataframe["adx"] = ta.ADX(dataframe, timeperiod=14) dataframe["atr"] = ta.ATR(dataframe, timeperiod=14) dataframe["plus_di"] = ta.PLUS_DI(dataframe, timeperiod=14) dataframe["minus_di"] = ta.MINUS_DI(dataframe, timeperiod=14) dataframe["atr_pct"] = dataframe["atr"] / dataframe["close"] dataframe["dist_ema200_pct"] = (dataframe["ema_200"] - dataframe["close"]) / dataframe["ema_200"] dataframe["ema_20_slope_atr"] = (dataframe["ema_20"] - dataframe["ema_20"].shift(5)) / dataframe["atr"] dataframe["ema_50_slope"] = dataframe["ema_50"] - dataframe["ema_50"].shift(5) return dataframe def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: dataframe["ema_20"] = ta.EMA(dataframe, timeperiod=20) dataframe["ema_50"] = ta.EMA(dataframe, timeperiod=50) dataframe["ema_200"] = ta.EMA(dataframe, timeperiod=200) dataframe["rsi"] = ta.RSI(dataframe, timeperiod=14) dataframe["adx"] = ta.ADX(dataframe, timeperiod=14) dataframe["atr"] = ta.ATR(dataframe, timeperiod=14) dataframe["plus_di"] = ta.PLUS_DI(dataframe, timeperiod=14) dataframe["minus_di"] = ta.MINUS_DI(dataframe, timeperiod=14) dataframe["volume_mean_20"] = dataframe["volume"].rolling(20, min_periods=20).mean() dataframe["donchian_low_40"] = dataframe["low"].rolling(40, min_periods=40).min().shift(1) dataframe["range_atr"] = (dataframe["high"] - dataframe["low"]) / dataframe["atr"] dataframe["ema50_extension_atr"] = (dataframe["ema_50"] - dataframe["close"]) / dataframe["atr"] dataframe["ema_50_slope"] = dataframe["ema_50"] - dataframe["ema_50"].shift(6) return dataframe def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: dataframe["enter_long"] = 0 dataframe["enter_short"] = 0 if not self._is_btc_pair(metadata["pair"]): return dataframe volume_ok = ( (dataframe["volume"] > 0) & (dataframe["volume_mean_20"] > 0) & (dataframe["volume"] >= dataframe["volume_mean_20"] * self.min_volume_factor.value) ) daily_extension = (dataframe["ema_50_1d"] - dataframe["close_1d"]) / dataframe["atr_1d"] daily_risk_off = ( ( (dataframe["close_1d"] < dataframe["ema_50_1d"]) & (dataframe["ema_50_slope_1d"] < 0) ) | ( (dataframe["close_1d"] < dataframe["ema_200_1d"]) & (dataframe["minus_di_1d"] > dataframe["plus_di_1d"]) ) ) higher_tf_bear = ( daily_risk_off & (daily_extension < self.max_daily_ema50_atr_extension.value) & (dataframe["rsi_1d"] > self.daily_rsi_min.value) & (dataframe["rsi_1d"] < self.daily_rsi_max.value) & (dataframe["close_4h"] < dataframe["ema_50_4h"]) & (dataframe["ema_50_slope_4h"] < 0) & (dataframe["minus_di_4h"] > dataframe["plus_di_4h"]) & (dataframe["close_1h"] < dataframe["ema_200_1h"]) & (dataframe["ema_50_slope_1h"] < 0) & (dataframe["minus_di_1h"] > dataframe["plus_di_1h"]) ) not_late = ( (dataframe["ema50_extension_atr"] < self.max_15m_ema50_atr_extension.value) & (dataframe["rsi"] > self.rsi_min.value) & (dataframe["rsi"] < self.rsi_max.value) & (dataframe["range_atr"] < 3.5) ) base_short = ( volume_ok & higher_tf_bear & not_late & (dataframe["close"] < dataframe["ema_200"]) & (dataframe["ema_50"] < dataframe["ema_200"]) & (dataframe["ema_50_slope"] < 0) & (dataframe["minus_di"] > dataframe["plus_di"]) & (dataframe["adx"] > self.adx_min.value) ) retest_rejection = ( base_short & (dataframe["high"] >= dataframe["ema_50"] * (1 - self.retest_buffer.value)) & (dataframe["close"] < dataframe["ema_20"]) & (dataframe["close"] < dataframe["open"]) ) breakdown = ( base_short & (dataframe["close"] < dataframe["donchian_low_40"]) & (dataframe["close"] < dataframe["open"]) & (dataframe["adx_1h"] > self.adx_min.value) & (dataframe["rsi_1h"] > self.rsi_min.value) ) dataframe.loc[retest_rejection, ["enter_short", "enter_tag"]] = (1, "bear_v2_retest_rejection") dataframe.loc[breakdown, ["enter_short", "enter_tag"]] = (1, "bear_v2_breakdown") return dataframe def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: dataframe["exit_long"] = 0 dataframe["exit_short"] = 0 return dataframe def custom_exit( self, pair: str, trade, current_time: datetime, current_rate: float, current_profit: float, **kwargs, ) -> str | bool | None: if not self.dp: return None dataframe, _ = self.dp.get_analyzed_dataframe(pair, self.timeframe) if dataframe.empty: return None candle = dataframe.iloc[-1] if not trade.is_short: return None if current_profit > 0.025 and candle["rsi"] < self.profit_take_rsi.value: return "bear_v2_rsi_profit_take" if current_profit > 0.015 and current_rate > candle["ema_20"]: return "bear_v2_profit_ema20_reclaim" if current_rate > candle["ema_50"] * (1 + self.ema50_exit_buffer.value): return "bear_v2_ema50_reclaim" if candle["close_1h"] > candle["ema_50_1h"] and current_profit < 0.01: return "bear_v2_1h_reclaim" return None def leverage( self, pair: str, current_time: datetime, current_rate: float, proposed_leverage: float, max_leverage: float, entry_tag: str | None, side: str, **kwargs, ) -> float: return 1.0 |
Strategy League — fixed backtest that feeds the ranking
Export report Freqtrade logsRun finished · took 105.5s
ℹ️ 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=0.37) — 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 | 7 | -0.55 | -0.88 | 0 | 7 | 0.0 | -1.23 | 4h 45m |
| Nov 2025 | bearish trending high vol | 4 | +0.40 | 0.94 | 3 | 1 | 75.0 | -0.92 | 6h 26m |
| Oct 2025 | bearish trending low vol | 3 | -0.17 | -0.51 | 1 | 2 | 33.3 | -1.09 | 4h 40m |
| Sep 2025 | bullish choppy low vol | 2 | -0.08 | -0.36 | 1 | 1 | 50.0 | -0.92 | 16h 00m |
| Aug 2025 | bearish choppy low vol | 4 | -0.42 | -0.95 | 0 | 4 | 0.0 | -0.85 | 4h 04m |
| Apr 2025 | bullish choppy low vol | 1 | +0.06 | 0.66 | 1 | 0 | 100.0 | -0.43 | 8h 00m |
| Mar 2025 | bearish trending high vol | 2 | +0.23 | 1.36 | 2 | 0 | 100.0 | -0.53 | 8h 00m |
| Feb 2025 | bearish trending low vol | 6 | -0.23 | -0.41 | 2 | 4 | 33.3 | -0.71 | 7h 48m |
| Sep 2024 | bearish choppy low vol | 7 | -0.23 | -0.58 | 2 | 5 | 28.6 | -0.48 | 4h 32m |
| Aug 2024 | bearish choppy high vol | 6 | -0.26 | -0.77 | 1 | 5 | 16.7 | -0.29 | 5h 25m |
| Jul 2024 | bearish trending low vol | 2 | +0.32 | 2.76 | 2 | 0 | 100.0 | -0.14 | 2h 00m |
| Jun 2024 | bearish choppy low vol | 7 | +0.03 | 0.05 | 4 | 3 | 57.1 | -0.36 | 8h 11m |
| Apr 2024 | bearish choppy high vol | 1 | +0.18 | 2.83 | 1 | 0 | 100.0 | -0.33 | 1h 15m |
| Jan 2024 | bearish choppy high vol | 1 | -0.04 | -0.51 | 0 | 1 | 0.0 | -0.5 | 1h 15m |
| Sep 2023 | bearish choppy low vol | 6 | -0.12 | -0.25 | 3 | 3 | 50.0 | -0.46 | 12h 40m |
| Aug 2023 | bearish choppy low vol | 3 | +0.05 | 0.19 | 1 | 2 | 33.3 | -0.34 | 11h 35m |
| Jun 2023 | bullish trending low vol | 4 | -0.20 | -0.58 | 0 | 4 | 0.0 | -0.39 | 5h 00m |
| May 2023 | bearish choppy low vol | 5 | +0.14 | 0.35 | 2 | 3 | 40.0 | -0.22 | 6h 27m |
| Mar 2023 | bullish trending high vol | 4 | +0.30 | 0.87 | 3 | 1 | 75.0 | -0.62 | 5h 19m |
| Jan 2023 | bullish trending low vol | 1 | -0.03 | -0.26 | 0 | 1 | 0.0 | -0.63 | 9h 45m |
| Dec 2022 | bearish trending low vol | 9 | -0.09 | -0.13 | 4 | 5 | 44.4 | -0.71 | 7h 08m |
| Nov 2022 | bearish trending high vol | 1 | -0.06 | -0.65 | 0 | 1 | 0.0 | -0.51 | 2h 00m |
| Oct 2022 | bullish choppy low vol | 13 | -0.07 | -0.05 | 7 | 6 | 53.8 | -0.49 | 8h 40m |
| Sep 2022 | bearish choppy high vol | 9 | -0.30 | -0.34 | 4 | 5 | 44.4 | -0.42 | 5h 45m |
| Aug 2022 | bullish choppy high vol | 1 | -0.09 | -1.02 | 0 | 1 | 0.0 | -0.09 | 4h 45m |
| Jun 2022 | bearish trending high vol | 1 | +0.24 | 2.80 | 1 | 0 | 100.0 | 0.0 | 6h 15m |
| May 2022 | bearish trending high vol | 3 | +0.20 | 0.90 | 3 | 0 | 100.0 | 0.0 | 9h 35m |
| Apr 2022 | bearish choppy high vol | 11 | +0.32 | 0.35 | 5 | 6 | 45.5 | -0.18 | 5h 56m |
| Mar 2022 | bullish choppy high vol | 2 | -0.11 | -0.69 | 1 | 1 | 50.0 | -0.11 | 4h 30m |
| Feb 2022 | bearish trending high vol | 3 | +0.20 | 0.84 | 2 | 1 | 66.7 | -0.06 | 5h 30m |
| Jan 2022 | bearish trending high vol | 3 | -0.00 | 0.05 | 1 | 2 | 33.3 | -0.21 | 8h 05m |
| Dec 2021 | bearish trending high vol | 7 | +1.04 | 1.52 | 5 | 2 | 71.4 | -0.09 | 4h 17m |
| Nov 2021 | bearish trending high vol | 3 | -0.14 | -0.84 | 1 | 2 | 33.3 | -0.25 | 5h 10m |
| Sep 2021 | bearish trending high vol | 2 | +0.10 | 0.57 | 1 | 1 | 50.0 | -0.12 | 2h 22m |
| Jul 2021 | bullish trending high vol | 3 | -0.01 | -0.02 | 1 | 2 | 33.3 | -0.21 | 8h 25m |
| Jun 2021 | bearish trending high vol | 1 | +0.21 | 2.80 | 1 | 0 | 100.0 | -0.01 | 3h 00m |
| May 2021 | bearish trending high vol | 1 | -0.09 | -0.89 | 0 | 1 | 0.0 | -0.22 | 2h 00m |
| Apr 2021 | bearish choppy high vol | 3 | -0.23 | -0.65 | 1 | 2 | 33.3 | -0.14 | 5h 35m |
Yearly breakdown
| Year | Trades | Profit % | Avg % | Win | Loss | Win % | DD % | Avg dur |
|---|---|---|---|---|---|---|---|---|
| 2025 | 29 | -0.76 | -0.26 | 10 | 19 | 34.5 | -1.23 | 6h 37m |
| 2024 | 24 | +0.00 | -0.02 | 10 | 14 | 41.7 | -0.5 | 5h 20m |
| 2023 | 23 | +0.14 | 0.07 | 9 | 14 | 39.1 | -0.63 | 8h 26m |
| 2022 | 56 | +0.24 | 0.07 | 28 | 28 | 50.0 | -0.71 | 6h 53m |
| 2021 | 20 | +0.88 | 0.46 | 10 | 10 | 50.0 | -0.25 | 4h 52m |
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 · 3 thing(s) worth reviewing before trusting the numbers
| Line | Pattern | Detail | |
|---|---|---|---|
| 21 | review | startup_candles_too_small | startup_candle_count is 420, but EMA(timeperiod=200) needing 3x warmup needs at least 600 candles -- so the first 180+ candles of every backtest use an indicator that hasn't warmed up. Recursive indicators (EMA/RSI/ADX/ATR) want several times their period, not exactly it |
| 25 | review | dead_callback | max_entry_position_adjustment only caps additional entries, which can't happen while position_adjustment_enable is off -- this setting has no effect |
| 214 | 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.