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 | import logging import numpy as np # noqa import pandas as pd # noqa from pandas import DataFrame from typing import Optional, Union from freqtrade.persistence import Trade, Order from freqtrade.strategy import (BooleanParameter, CategoricalParameter, DecimalParameter, IStrategy, IntParameter) import datetime import talib.abstract as ta import freqtrade.vendor.qtpylib.indicators as qtpylib import pandas_ta as pta class HPStrategyV6(IStrategy): INTERFACE_VERSION = 3 timeframe = '15m' leverage_value = 3 minimal_roi = { "0": 0.03 } last_dca_timeframe = {} max_entry_position_adjustment = 5 max_dca_multiplier = 5.5 open_trade_limit = 6 position_adjustment_enable = True dca_threshold_pct = DecimalParameter(0.01, 0.20, default=0.04 * leverage_value, decimals=2, space='buy', optimize=position_adjustment_enable) rolling_ha_treshold = IntParameter(3, 10, default=9, space='buy', optimize=True) trailing_stop = True trailing_only_offset_is_reached = True trailing_stop_positive = 0.003 trailing_stop_positive_offset = 0.01 stoploss = -0.15 * leverage_value use_exit_signal = True ignore_roi_if_entry_signal = True use_custom_stoploss = True order_types = { 'entry': 'market', 'exit': 'market', 'stoploss': 'market', 'stoploss_on_exchange': False } 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: return self.leverage_value def calculate_heiken_ashi(self, dataframe): if dataframe.empty: raise ValueError("DataFrame je prázdný") heiken_ashi = pd.DataFrame(index=dataframe.index) heiken_ashi['HA_Close'] = (dataframe['open'] + dataframe['high'] + dataframe['low'] + dataframe['close']) / 4 heiken_ashi['HA_Open'] = heiken_ashi['HA_Close'].shift(1) heiken_ashi['HA_Open'].iloc[0] = heiken_ashi['HA_Close'].iloc[0] heiken_ashi['HA_High'] = heiken_ashi[['HA_Open', 'HA_Close']].join(dataframe['high'], how='inner').max(axis=1) heiken_ashi['HA_Low'] = heiken_ashi[['HA_Open', 'HA_Close']].join(dataframe['low'], how='inner').min(axis=1) heiken_ashi['HA_Close'] = heiken_ashi['HA_Close'].rolling(window=self.rolling_ha_treshold.value).mean() heiken_ashi['HA_Open'] = heiken_ashi['HA_Open'].rolling(window=self.rolling_ha_treshold.value).mean() heiken_ashi['HA_High'] = heiken_ashi['HA_High'].rolling(window=self.rolling_ha_treshold.value).mean() heiken_ashi['HA_Low'] = heiken_ashi['HA_Low'].rolling(window=self.rolling_ha_treshold.value).mean() return heiken_ashi def should_already_sell(self, dataframe): heiken_ashi = self.calculate_heiken_ashi(dataframe) last_candle = heiken_ashi.iloc[-1] if last_candle['HA_Close'] > last_candle['HA_Open']: return False else: return True def adjust_entry_price(self, trade: Trade, order: Optional[Order], pair: str, current_time: datetime, proposed_rate: float, current_order_rate: float, entry_tag: Optional[str], side: str, **kwargs) -> float: return proposed_rate 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: return (Trade.get_open_trade_count() < self.open_trade_limit) def confirm_trade_exit(self, pair: str, trade: Trade, order_type: str, amount: float, rate: float, time_in_force: str, exit_reason: str, current_time: datetime, **kwargs) -> bool: force_reasons = ['force_sell', 'force_exit'] dataframe, _ = self.dp.get_analyzed_dataframe(trade.pair, self.timeframe) if 'trailing' in exit_reason: return rate > trade.open_rate + self.trailing_stop_positive_offset * self.leverage_value if exit_reason in force_reasons: return True should_already_sell = self.should_already_sell(dataframe) if should_already_sell: return True return False 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) atr = dataframe.iloc[-1]['atr'] atr_multiplier = 3 stop_loss_atr = atr * atr_multiplier stop_loss_percentage = -stop_loss_atr / current_rate return max(stop_loss_percentage, self.stoploss) def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: dataframe['cci'] = ta.CCI(dataframe, timeperiod=14) dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14) dataframe['atr'] = ta.ATR(dataframe, timeperiod=14) return dataframe def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: dataframe.loc[(dataframe['cci'] < -100) & (dataframe['rsi'] < 30) & (dataframe['volume'] > 0), ['enter_long', 'enter_tag']] = (1, 'cci_buy') return dataframe def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: dataframe.loc[(dataframe['cci'] > 100) & (dataframe['rsi'] > 70) & (dataframe['volume'] > 0), ['exit_long', 'exit_tag']] = (1, 'cci_sell') return dataframe def custom_stake_amount(self, pair: str, current_time: datetime, current_rate: float, proposed_stake: float, min_stake: Optional[float], max_stake: float, leverage: float, entry_tag: Optional[str], side: str, **kwargs) -> float: return proposed_stake / self.max_dca_multiplier def adjust_trade_position(self, trade: Trade, current_time: datetime, current_rate: float, current_profit: float, min_stake: Optional[float], max_stake: float, current_entry_rate: float, current_exit_rate: float, current_entry_profit: float, current_exit_profit: float, **kwargs) -> Optional[float]: last_dca_time = self.last_dca_timeframe.get(trade.id, datetime.datetime.min.replace(tzinfo=datetime.timezone.utc)) if current_time - last_dca_time < datetime.timedelta(minutes=self.timeframe_to_minutes(self.timeframe)): return None # Skip DCA if already done in the current timeframe if current_profit > self.dca_threshold_pct.value and trade.nr_of_successful_exits == 0: return -(trade.stake_amount / 2) if current_profit > -self.dca_threshold_pct.value: return None dataframe, _ = self.dp.get_analyzed_dataframe(trade.pair, self.timeframe) last_candle = dataframe.iloc[-1].squeeze() previous_candle = dataframe.iloc[-2].squeeze() if last_candle['close'] < previous_candle['close']: return None filled_entries = trade.select_filled_orders(trade.entry_side) count_of_entries = trade.nr_of_successful_entries try: stake_amount = filled_entries[0].stake_amount stake_amount = stake_amount * (1 + (count_of_entries * 0.25)) self.last_dca_timeframe[trade.id] = current_time return stake_amount except Exception as exception: return None return None def timeframe_to_minutes(self, timeframe: str) -> int: """Convert a timeframe string to minutes.""" if 'm' in timeframe: return int(timeframe.replace('m', '')) elif 'h' in timeframe: return int(timeframe.replace('h', '')) * 60 elif 'd' in timeframe: return int(timeframe.replace('d', '')) * 1440 else: raise ValueError(f"Unsupported timeframe: {timeframe}") |
Strategy League — fixed backtest that feeds the ranking
Export report Freqtrade logsRun finished · took 855.1s
ℹ️ This strategy uses a trailing stop / custom_stoploss() — 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 →
- did not beat simply holding the market
- statistically significant edge (p=0.00)
- 100% of resampled runs stayed profitable
- profitable across 98% of rolling 3-month windows
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 |
|---|---|---|---|---|---|---|---|---|---|
| Jan 2026 | bullish trending low vol | 6 | -9.12 | -12.96 | 0 | 6 | 0.0 | -3.23 | 916h 30m |
| Dec 2025 | bearish trending low vol | 22 | +0.64 | 1.31 | 21 | 1 | 95.5 | -0.0 | 63h 13m |
| Nov 2025 | bearish trending high vol | 60 | +3.71 | 1.55 | 58 | 2 | 96.7 | -0.0 | 49h 31m |
| Oct 2025 | bearish trending low vol | 62 | +3.09 | 1.74 | 61 | 1 | 98.4 | -0.0 | 81h 40m |
| Sep 2025 | bullish choppy low vol | 26 | +1.15 | 1.43 | 24 | 2 | 92.3 | -0.0 | 108h 48m |
| Aug 2025 | bullish choppy low vol | 33 | +1.66 | 1.93 | 32 | 1 | 97.0 | -0.0 | 94h 33m |
| Jul 2025 | bullish choppy low vol | 66 | +2.90 | 1.94 | 64 | 2 | 97.0 | -0.0 | 64h 47m |
| Jun 2025 | bearish choppy low vol | 22 | +2.74 | 2.45 | 22 | 0 | 100.0 | 0.0 | 169h 34m |
| May 2025 | bullish trending low vol | 54 | +2.65 | 1.84 | 54 | 0 | 100.0 | 0.0 | 57h 59m |
| Apr 2025 | bullish choppy low vol | 75 | +3.90 | 1.95 | 71 | 4 | 94.7 | -0.0 | 49h 11m |
| Mar 2025 | bearish trending high vol | 74 | +4.98 | 2.04 | 74 | 0 | 100.0 | 0.0 | 62h 25m |
| Feb 2025 | bearish trending low vol | 46 | +2.16 | 1.75 | 45 | 1 | 97.8 | -0.0 | 55h 16m |
| Jan 2025 | bearish choppy low vol | 74 | +3.10 | 1.81 | 71 | 3 | 95.9 | -0.0 | 49h 35m |
| Dec 2024 | bullish trending low vol | 106 | +5.74 | 1.73 | 105 | 1 | 99.1 | -0.0 | 26h 13m |
| Nov 2024 | bullish trending low vol | 123 | +5.02 | 1.94 | 122 | 1 | 99.2 | -0.0 | 36h 31m |
| Oct 2024 | bullish choppy low vol | 39 | +1.62 | 2.02 | 39 | 0 | 100.0 | 0.0 | 74h 04m |
| Sep 2024 | bearish choppy low vol | 69 | +3.25 | 1.93 | 69 | 0 | 100.0 | 0.0 | 106h 43m |
| Aug 2024 | bearish choppy high vol | 31 | +2.67 | 2.07 | 31 | 0 | 100.0 | 0.0 | 116h 49m |
| Jul 2024 | bearish trending low vol | 43 | +3.13 | 1.91 | 42 | 1 | 97.7 | -0.01 | 156h 05m |
| Jun 2024 | bearish choppy low vol | 9 | +0.78 | 1.54 | 9 | 0 | 100.0 | 0.0 | 107h 15m |
| May 2024 | bullish choppy high vol | 20 | +1.37 | 1.41 | 20 | 0 | 100.0 | 0.0 | 216h 16m |
| Apr 2024 | bearish choppy high vol | 11 | +1.79 | 1.99 | 11 | 0 | 100.0 | 0.0 | 172h 22m |
| Mar 2024 | bullish trending high vol | 82 | +2.93 | 1.60 | 82 | 0 | 100.0 | 0.0 | 29h 13m |
| Feb 2024 | bullish trending low vol | 60 | +2.49 | 2.12 | 59 | 1 | 98.3 | -0.0 | 338h 45m |
| Jan 2024 | bearish choppy high vol | 27 | +1.65 | 1.76 | 24 | 3 | 88.9 | -0.0 | 159h 21m |
| Dec 2023 | bullish trending low vol | 63 | +2.11 | 1.66 | 62 | 1 | 98.4 | -0.0 | 47h 23m |
| Nov 2023 | bullish trending low vol | 55 | +2.58 | 2.28 | 54 | 1 | 98.2 | -0.0 | 34h 03m |
| Oct 2023 | bullish trending low vol | 39 | +2.88 | 1.94 | 39 | 0 | 100.0 | 0.0 | 188h 12m |
| Sep 2023 | bearish choppy low vol | 7 | +0.45 | 3.17 | 7 | 0 | 100.0 | 0.0 | 356h 51m |
| Aug 2023 | bearish choppy low vol | 13 | +1.26 | 2.64 | 13 | 0 | 100.0 | 0.0 | 176h 47m |
| Jul 2023 | bullish trending low vol | 20 | +2.23 | 3.87 | 20 | 0 | 100.0 | 0.0 | 208h 04m |
| Jun 2023 | bullish trending low vol | 12 | +1.51 | 1.85 | 11 | 1 | 91.7 | -0.01 | 502h 26m |
| Apr 2023 | bullish trending low vol | 29 | +0.86 | 1.26 | 26 | 3 | 89.7 | -0.0 | 90h 01m |
| Mar 2023 | bullish trending high vol | 37 | +3.52 | 2.24 | 36 | 1 | 97.3 | -0.0 | 128h 19m |
| Feb 2023 | bullish trending low vol | 35 | +1.36 | 1.66 | 33 | 2 | 94.3 | -0.0 | 41h 24m |
| Jan 2023 | bullish trending low vol | 76 | +4.64 | 2.11 | 75 | 1 | 98.7 | -0.0 | 81h 21m |
| Dec 2022 | bearish trending low vol | 6 | +0.23 | 2.14 | 6 | 0 | 100.0 | 0.0 | 48h 32m |
| Nov 2022 | bearish trending high vol | 53 | +5.11 | 2.33 | 53 | 0 | 100.0 | 0.0 | 109h 23m |
| Oct 2022 | bullish choppy low vol | 20 | +1.07 | 2.13 | 20 | 0 | 100.0 | 0.0 | 101h 43m |
| Sep 2022 | bearish choppy high vol | 41 | +0.37 | 1.52 | 40 | 1 | 97.6 | -0.73 | 83h 39m |
| Aug 2022 | bullish choppy high vol | 68 | +3.10 | 2.11 | 67 | 1 | 98.5 | -0.0 | 18h 35m |
| Jul 2022 | bearish trending high vol | 66 | +2.82 | 1.89 | 66 | 0 | 100.0 | -0.06 | 63h 31m |
| Jun 2022 | bearish trending high vol | 32 | +1.98 | 2.23 | 32 | 0 | 100.0 | -1.14 | 58h 17m |
| May 2022 | bearish trending high vol | 69 | +1.25 | 1.79 | 65 | 4 | 94.2 | -1.3 | 63h 04m |
| Apr 2022 | bearish choppy high vol | 32 | +1.91 | 1.75 | 31 | 1 | 96.9 | -0.0 | 70h 32m |
| Mar 2022 | bullish choppy high vol | 79 | +2.79 | 1.67 | 78 | 1 | 98.7 | -0.0 | 45h 33m |
| Feb 2022 | bearish trending high vol | 64 | +4.84 | 1.64 | 62 | 2 | 96.9 | -0.01 | 87h 51m |
| Jan 2022 | bearish trending high vol | 38 | +1.93 | 1.30 | 37 | 1 | 97.4 | -0.0 | 41h 30m |
| Dec 2021 | bearish trending high vol | 89 | +3.10 | 1.58 | 86 | 3 | 96.6 | -0.0 | 39h 25m |
| Nov 2021 | bullish trending high vol | 74 | +2.42 | 1.47 | 70 | 4 | 94.6 | -0.01 | 47h 14m |
| Oct 2021 | bullish trending high vol | 122 | +6.03 | 1.76 | 121 | 1 | 99.2 | -0.0 | 39h 32m |
| Sep 2021 | bearish trending high vol | 116 | +4.32 | 1.42 | 115 | 1 | 99.1 | -0.01 | 36h 31m |
| Aug 2021 | bullish trending high vol | 126 | +4.02 | 1.40 | 126 | 0 | 100.0 | 0.0 | 26h 03m |
| Jul 2021 | bearish trending high vol | 58 | +1.79 | 1.44 | 57 | 1 | 98.3 | -0.0 | 34h 15m |
| Jun 2021 | bearish trending high vol | 64 | +4.61 | 1.70 | 62 | 2 | 96.9 | -0.01 | 34h 19m |
| May 2021 | bearish trending high vol | 220 | +11.24 | 2.12 | 218 | 2 | 99.1 | -0.0 | 9h 09m |
| Apr 2021 | bearish choppy high vol | 168 | +7.07 | 1.98 | 165 | 3 | 98.2 | -0.0 | 14h 28m |
| Mar 2021 | bullish choppy high vol | 134 | +4.35 | 1.61 | 132 | 2 | 98.5 | -0.01 | 22h 46m |
| Feb 2021 | bullish trending high vol | 221 | +8.00 | 1.72 | 219 | 2 | 99.1 | -0.0 | 5h 14m |
| Jan 2021 | bullish trending high vol | 229 | +9.73 | 2.03 | 228 | 1 | 99.6 | -0.0 | 7h 12m |
Yearly breakdown
| Year | Trades | Profit % | Avg % | Win | Loss | Win % | DD % | Avg dur |
|---|---|---|---|---|---|---|---|---|
| 2026 | 6 | -9.12 | -12.96 | 0 | 6 | 0.0 | -3.23 | 916h 30m |
| 2025 | 614 | +32.68 | 1.83 | 597 | 17 | 97.2 | 0.0 | 66h 49m |
| 2024 | 620 | +32.44 | 1.86 | 613 | 7 | 98.9 | -0.01 | 100h 06m |
| 2023 | 386 | +23.40 | 2.07 | 376 | 10 | 97.4 | -0.01 | 109h 16m |
| 2022 | 568 | +27.40 | 1.84 | 557 | 11 | 98.1 | -1.3 | 63h 52m |
| 2021 | 1621 | +66.68 | 1.76 | 1599 | 22 | 98.6 | -0.01 | 20h 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 · 2 thing(s) worth reviewing before trusting the numbers
| Line | Pattern | Detail | |
|---|---|---|---|
| 16 | review | missing_startup_candles | uses recursive indicators (ATR, RSI) but startup_candle_count is not set (default 0). Their value at a bar depends on all bars before it, so freqtrade trims no warmup and the backtest opens with unwarmed values that can't occur live. The longest lookback visible here is CCI(timeperiod=14), so it needs at least that many. Set it to a few times the longest period and confirm with `freqtrade recursive-analysis` |
| 120 | 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.