3 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 281 282 283 | import numpy as np # noqa import pandas as pd # noqa from pandas import DataFrame # noqa from datetime import datetime # noqa from typing import Optional, Union # noqa from freqtrade.strategy import (BooleanParameter, CategoricalParameter, DecimalParameter, IStrategy, IntParameter) # -------------------------------- # Add your lib to import here import talib.abstract as ta import pandas_ta as pta import freqtrade.vendor.qtpylib.indicators as qtpylib from functools import reduce class MACDSMA200hyperopt2(IStrategy): # Strategy interface version - allow new iterations of the strategy interface. # Check the documentation or the Sample strategy to get the latest version. INTERFACE_VERSION = 3 # Optimal timeframe for the strategy. timeframe = '1d' # Can this strategy go short? can_short: bool = True # Minimal ROI designed for the strategy. # This attribute will be overridden if the config file contains "minimal_roi". minimal_roi = { "0": 100 } # Optimal stoploss designed for the strategy. # This attribute will be overridden if the config file contains "stoploss". stoploss = -0.335 # Trailing stoploss trailing_stop = True trailing_only_offset_is_reached = True trailing_stop_positive = 0.01 trailing_stop_positive_offset = 0.04 # Disabled / not configured # Run "populate_indicators()" only for new candle. process_only_new_candles = True # These values can be overridden in the config. use_exit_signal = True exit_profit_only = False ignore_roi_if_entry_signal = False # Number of candles the strategy requires before producing valid signals startup_candle_count: int = 30 # Strategy parameters buy_ema_short = IntParameter(7, 17, default=17) buy_ema_long = IntParameter(20, 35, default=27) sell_ema_short = IntParameter(7, 17, default=16) sell_ema_long = IntParameter(20, 35, default=27) # Optional order type mapping. order_types = { 'entry': 'limit', 'exit': 'limit', 'stoploss': 'market', 'stoploss_on_exchange': False } # Optional order time in force. order_time_in_force = { 'entry': 'GTC', 'exit': 'GTC' } @property def plot_config(self): return { # Main plot indicators (Moving averages, ...) 'main_plot': { 'tema': {}, 'sar': {'color': 'white'}, }, 'subplots': { # Subplots - each dict defines one additional plot "MACD": { 'macd': {'color': 'blue'}, 'macdsignal': {'color': 'orange'}, }, } } def informative_pairs(self): return [] def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: for val in self.buy_ema_short.range: dataframe[f'ema_short_{val}'] = ta.EMA(dataframe, timeperiod=val) # Calculate all ema_long values for val in self.buy_ema_long.range: dataframe[f'ema_long_{val}'] = ta.EMA(dataframe, timeperiod=val) for val in self.sell_ema_short.range: dataframe[f'ema_short_{val}'] = ta.EMA(dataframe, timeperiod=val) # Calculate all ema_long values for val in self.sell_ema_long.range: dataframe[f'ema_long_{val}'] = ta.EMA(dataframe, timeperiod=val) # MACD macd = ta.MACD(dataframe) dataframe['macd'] = macd['macd'] dataframe['macdsignal'] = macd['macdsignal'] dataframe['macdhist'] = macd['macdhist'] # # EMA - Exponential Moving Average # dataframe['ema3'] = ta.EMA(dataframe, timeperiod=3) # dataframe['ema5'] = ta.EMA(dataframe, timeperiod=5) # dataframe['ema12'] = ta.EMA(dataframe, timeperiod=12) # dataframe['ema26'] = ta.EMA(dataframe, timeperiod=26) # dataframe['ema50'] = ta.EMA(dataframe, timeperiod=50) # dataframe['ema100'] = ta.EMA(dataframe, timeperiod=100) # # SMA - Simple Moving Average # dataframe['sma3'] = ta.SMA(dataframe, timeperiod=3) # dataframe['sma5'] = ta.SMA(dataframe, timeperiod=5) # dataframe['sma10'] = ta.SMA(dataframe, timeperiod=10) # dataframe['sma21'] = ta.SMA(dataframe, timeperiod=21) # dataframe['sma50'] = ta.SMA(dataframe, timeperiod=50) dataframe['sma200'] = ta.SMA(dataframe, timeperiod=200) return dataframe def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: conditions = [] conditions.append(dataframe[f'ema_short_{self.buy_ema_short.value}'] > dataframe[f'ema_long_{self.buy_ema_long.value}']) conditions.append(dataframe['macdhist'] > 0) conditions.append(dataframe['macd'] > 0) conditions.append(dataframe['macdsignal'] > 0) conditions.append(dataframe['close'] > dataframe['sma200']) conditions.append(dataframe['volume'] > 0) if conditions: dataframe.loc[ reduce(lambda x, y: x & y, conditions), 'enter_long'] = 1 ''' dataframe.loc[ ( (dataframe['macdhist'] > 0) & (dataframe['macd'] > 0) & (dataframe['macdsignal'] > 0) & (dataframe['ema12'] > dataframe['ema26']) & (dataframe['close'] > dataframe['sma200']) & (dataframe['volume'] > 0) ), 'enter_long'] = 1 # Uncomment to use shorts (Only used in futures/margin mode. Check the documentation for more info) ''' conditions = [] conditions.append(dataframe[f'ema_short_{self.buy_ema_short.value}'] < dataframe[f'ema_long_{self.buy_ema_long.value}']) conditions.append(dataframe['macdhist'] < 0) conditions.append(dataframe['macd'] < 0) conditions.append(dataframe['macdsignal'] < 0) conditions.append(dataframe['close'] < dataframe['sma200']) conditions.append(dataframe['volume'] > 0) if conditions: dataframe.loc[ reduce(lambda x, y: x & y, conditions), 'enter_short'] = 1 ''' dataframe.loc[ ( (dataframe['macdhist'] < 0) & (dataframe['macd'] < 0) & (dataframe['macdsignal'] < 0) & (dataframe['ema12'] < dataframe['ema26']) & (dataframe['close'] < dataframe['sma200']) & (dataframe['volume'] > 0) ), 'enter_short'] = 1 ''' return dataframe def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: conditions = [] conditions.append(dataframe['macd'] < 0) conditions.append(qtpylib.crossed_below(dataframe[f'ema_short_{self.sell_ema_short.value}'], dataframe[f'ema_long_{self.sell_ema_long.value}'])) conditions.append(dataframe['volume'] > 0) if conditions: dataframe.loc[ reduce(lambda x, y: x & y, conditions), 'exit_long'] = 1 ''' dataframe.loc[ ( (dataframe['macd'] < 0) & (qtpylib.crossed_below(dataframe['ema12'], dataframe['ema26'])) & (dataframe['volume'] > 0) ), 'exit_long'] = 1 ''' # Uncomment to use shorts (Only used in futures/margin mode. Check the documentation for more info) conditions = [] conditions.append(dataframe['macd'] > 0) conditions.append(qtpylib.crossed_above(dataframe[f'ema_short_{self.sell_ema_short.value}'], dataframe[f'ema_long_{self.sell_ema_long.value}'])) conditions.append(dataframe['volume'] > 0) if conditions: dataframe.loc[ reduce(lambda x, y: x & y, conditions), 'exit_short'] = 1 ''' dataframe.loc[ ( (dataframe['macd'] > 0) & (qtpylib.crossed_above(dataframe['ema12'], dataframe['ema26'])) & (dataframe['volume'] > 0) ), 'exit_short'] = 1 ''' return dataframe # HYPEROPT 2 # Best result: # 544/1000: 700 trades. 630/0/70 Wins/Draws/Losses. Avg profit 1.72%. Median profit 2.96%. Total profit 32285.70929172 USDT ( 645.71%). Avg duration 3 days, 14:12:00 min. # Objective: -2.00641 # # Buy hyperspace params: # buy_params = { # "buy_ema_long": 27, # "buy_ema_short": 17, # } # # Sell hyperspace params: # sell_params = { # "sell_ema_long": 27, # "sell_ema_short": 16, # } # # ROI table: # value loaded from strategy # minimal_roi = { # "0": 100 # } # # Stoploss: # stoploss = -0.335 # # Trailing stop: # trailing_stop = True # trailing_stop_positive = 0.01 # trailing_stop_positive_offset = 0.04 # trailing_only_offset_is_reached = True # bot morš ugasn po prvem končanem bull runnu bo bitcoin halvingu. Ker je biu a big drop po bull runnu so najbol volatile coini vsi tejakl 33% hit in si zgubu 7k profitou. # bejsikli polic se morš pazt # READY ZA DRY RUN # Dry run bug # https://github.com/freqtrade/freqtrade/issues/614 # freqtrade trade --config MACDSMA200hyperopt2.json --strategy MACDSMA200hyperopt2 |
Strategy League — fixed backtest that feeds the ranking
Export report Freqtrade logsRun finished · took 31.7s
ℹ️ This strategy uses a trailing stop — freqtrade only
re-checks these once per 1d candle by default, not against the price movement within it.
For a more accurate read, re-run this backtest locally with --timeframe-detail 1m
(or 5m — freqtrade's own docs use 5m detail for an hourly strategy as a lighter
alternative). 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 →
- statistically significant edge (p=0.00)
- 100% of resampled runs stayed profitable
- profitable across 94% of rolling 3-month windows
- comfortably beat buy-and-hold
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 | 8 | -3.24 | -4.12 | 1 | 7 | 12.5 | -0.38 | 603h 00m |
| Dec 2025 | bearish trending low vol | 67 | +24.55 | 3.70 | 66 | 1 | 98.5 | -0.02 | 72h 43m |
| Nov 2025 | bearish trending high vol | 162 | +45.00 | 2.80 | 159 | 3 | 98.1 | -1.23 | 36h 44m |
| Oct 2025 | bearish trending low vol | 69 | +8.68 | 1.12 | 56 | 13 | 81.2 | -2.05 | 85h 34m |
| Sep 2025 | bullish choppy low vol | 45 | -2.31 | -0.39 | 31 | 14 | 68.9 | -0.86 | 183h 28m |
| Aug 2025 | bearish choppy low vol | 52 | +0.41 | 0.13 | 41 | 11 | 78.8 | -0.76 | 132h 55m |
| Jul 2025 | bullish choppy low vol | 111 | +23.90 | 2.19 | 102 | 9 | 91.9 | -1.97 | 59h 41m |
| Jun 2025 | bearish choppy low vol | 108 | +21.55 | 2.03 | 100 | 8 | 92.6 | -3.66 | 72h 40m |
| May 2025 | bullish trending low vol | 45 | -5.14 | -1.12 | 37 | 8 | 82.2 | -3.42 | 123h 12m |
| Apr 2025 | bullish choppy low vol | 105 | +19.14 | 1.87 | 97 | 8 | 92.4 | -2.51 | 75h 26m |
| Mar 2025 | bearish trending high vol | 90 | +19.38 | 2.16 | 84 | 6 | 93.3 | -0.92 | 38h 24m |
| Feb 2025 | bearish trending low vol | 113 | +32.50 | 2.96 | 108 | 5 | 95.6 | -3.32 | 50h 20m |
| Jan 2025 | bearish choppy low vol | 57 | +3.27 | 0.58 | 45 | 12 | 78.9 | -4.75 | 110h 44m |
| Dec 2024 | bullish trending low vol | 115 | +26.09 | 2.35 | 105 | 10 | 91.3 | -3.91 | 52h 23m |
| Nov 2024 | bullish trending low vol | 197 | +52.54 | 2.74 | 186 | 11 | 94.4 | -2.24 | 44h 57m |
| Oct 2024 | bullish choppy low vol | 28 | +2.67 | 1.02 | 21 | 7 | 75.0 | -2.57 | 162h 51m |
| Sep 2024 | bearish choppy low vol | 77 | +6.98 | 0.91 | 65 | 12 | 84.4 | -3.76 | 110h 20m |
| Aug 2024 | bearish choppy high vol | 89 | -1.01 | -0.28 | 77 | 12 | 86.5 | -3.71 | 60h 08m |
| Jul 2024 | bearish trending low vol | 81 | +16.97 | 2.04 | 74 | 7 | 91.4 | -1.92 | 74h 58m |
| Jun 2024 | bearish choppy low vol | 125 | +40.79 | 3.31 | 118 | 7 | 94.4 | -2.44 | 75h 04m |
| May 2024 | bullish choppy high vol | 31 | +8.61 | 2.81 | 27 | 4 | 87.1 | -3.82 | 135h 29m |
| Apr 2024 | bearish choppy high vol | 58 | -19.80 | -3.59 | 45 | 13 | 77.6 | -5.11 | 117h 31m |
| Mar 2024 | bullish trending high vol | 97 | +30.98 | 3.32 | 93 | 4 | 95.9 | -0.84 | 49h 14m |
| Feb 2024 | bullish trending low vol | 102 | +35.57 | 3.59 | 97 | 5 | 95.1 | -1.17 | 73h 11m |
| Jan 2024 | bearish choppy high vol | 39 | -4.06 | -1.10 | 28 | 11 | 71.8 | -1.76 | 228h 55m |
| Dec 2023 | bullish trending low vol | 87 | +33.90 | 4.00 | 83 | 4 | 95.4 | -0.25 | 76h 41m |
| Nov 2023 | bullish trending low vol | 93 | +38.29 | 4.20 | 92 | 1 | 98.9 | -0.7 | 55h 45m |
| Oct 2023 | bullish trending low vol | 60 | +4.63 | 0.85 | 48 | 12 | 80.0 | -2.39 | 172h 00m |
| Sep 2023 | bearish choppy low vol | 24 | +5.75 | 2.46 | 22 | 2 | 91.7 | -1.67 | 209h 00m |
| Aug 2023 | bearish choppy low vol | 74 | +4.45 | 0.65 | 66 | 8 | 89.2 | -3.13 | 93h 24m |
| Jul 2023 | bullish trending low vol | 39 | +8.51 | 2.14 | 28 | 11 | 71.8 | -3.03 | 177h 51m |
| Jun 2023 | bullish trending low vol | 89 | +16.28 | 1.84 | 80 | 9 | 89.9 | -3.19 | 93h 02m |
| May 2023 | bearish choppy low vol | 52 | +7.02 | 1.36 | 45 | 7 | 86.5 | -2.77 | 123h 42m |
| Apr 2023 | bullish trending low vol | 37 | -3.76 | -1.05 | 27 | 10 | 73.0 | -3.58 | 208h 52m |
| Mar 2023 | bullish trending high vol | 84 | +4.21 | 0.53 | 71 | 13 | 84.5 | -2.26 | 80h 00m |
| Feb 2023 | bullish trending low vol | 24 | +7.34 | 3.13 | 22 | 2 | 91.7 | -0.47 | 205h 00m |
| Jan 2023 | bullish trending low vol | 76 | +5.46 | 0.73 | 64 | 12 | 84.2 | -4.25 | 112h 06m |
| Dec 2022 | bearish trending low vol | 42 | +19.04 | 4.57 | 41 | 1 | 97.6 | -4.46 | 164h 00m |
| Nov 2022 | bearish trending high vol | 67 | -5.62 | -0.84 | 54 | 13 | 80.6 | -6.51 | 77h 01m |
| Oct 2022 | bullish choppy low vol | 45 | +5.63 | 1.25 | 37 | 8 | 82.2 | -5.72 | 212h 16m |
| Sep 2022 | bearish choppy high vol | 29 | +0.10 | 0.13 | 24 | 5 | 82.8 | -5.41 | 132h 25m |
| Aug 2022 | bullish choppy high vol | 32 | +3.02 | 0.94 | 27 | 5 | 84.4 | -7.65 | 103h 30m |
| Jul 2022 | bullish trending high vol | 9 | -10.62 | -11.88 | 4 | 5 | 44.4 | -5.47 | 421h 20m |
| Jun 2022 | bearish trending high vol | 120 | +28.72 | 2.46 | 116 | 4 | 96.7 | -2.97 | 38h 24m |
| May 2022 | bearish trending high vol | 145 | +73.46 | 5.22 | 144 | 1 | 99.3 | -0.5 | 27h 58m |
| Apr 2022 | bearish choppy high vol | 111 | +19.80 | 1.88 | 103 | 8 | 92.8 | -10.59 | 39h 47m |
| Mar 2022 | bullish choppy high vol | 50 | -12.46 | -2.63 | 37 | 13 | 74.0 | -8.61 | 141h 07m |
| Feb 2022 | bearish trending high vol | 72 | +13.31 | 1.66 | 66 | 6 | 91.7 | -6.53 | 65h 40m |
| Jan 2022 | bearish trending high vol | 154 | +49.84 | 3.39 | 149 | 5 | 96.8 | -3.54 | 49h 52m |
| Dec 2021 | bearish trending high vol | 120 | +28.28 | 2.40 | 114 | 6 | 95.0 | -9.81 | 38h 12m |
| Nov 2021 | bearish trending high vol | 82 | +22.47 | 2.78 | 74 | 8 | 90.2 | -24.96 | 84h 18m |
| Oct 2021 | bullish trending high vol | 52 | -0.65 | -0.12 | 43 | 9 | 82.7 | -36.36 | 127h 23m |
| Sep 2021 | bearish trending high vol | 124 | -23.93 | -1.98 | 104 | 20 | 83.9 | -28.86 | 65h 25m |
| Aug 2021 | bullish trending high vol | 85 | +25.52 | 3.11 | 80 | 5 | 94.1 | -23.11 | 42h 21m |
| Jul 2021 | bullish trending high vol | 47 | -7.29 | -1.62 | 40 | 7 | 85.1 | -15.86 | 110h 49m |
| Jun 2021 | bearish trending high vol | 76 | +11.28 | 1.55 | 73 | 3 | 96.1 | -5.66 | 5h 22m |
Yearly breakdown
| Year | Trades | Profit % | Avg % | Win | Loss | Win % | DD % | Avg dur |
|---|---|---|---|---|---|---|---|---|
| 2026 | 8 | -3.24 | -4.12 | 1 | 7 | 12.5 | -0.38 | 603h 00m |
| 2025 | 1024 | +190.93 | 1.89 | 926 | 98 | 90.4 | -4.75 | 73h 31m |
| 2024 | 1039 | +196.33 | 1.91 | 936 | 103 | 90.1 | -5.11 | 77h 53m |
| 2023 | 739 | +132.08 | 1.83 | 648 | 91 | 87.7 | -4.25 | 113h 11m |
| 2022 | 876 | +184.22 | 2.16 | 802 | 74 | 91.6 | -10.59 | 74h 18m |
| 2021 | 586 | +55.68 | 0.97 | 528 | 58 | 90.1 | -36.36 | 60h 30m |
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 | |
|---|---|---|---|
| 55 | review | startup_candles_too_small | startup_candle_count is 30, but SMA(timeperiod=200) needs at least 200 candles -- so the first 170+ 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 |
ran by Ron · took s
Lookahead analysis
Freqtrade logsno lookahead bias detected
20 signal(s) analysed · 0 biased entries · 0 biased exits
ran by Ron · took 14.0s