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 | # --- Do not remove these libs --- from technical.util import resample_to_interval, resampled_merge from freqtrade.strategy import IStrategy from typing import Dict, List from functools import reduce from pandas import DataFrame from datetime import datetime # -------------------------------- import talib.abstract as ta import freqtrade.vendor.qtpylib.indicators as qtpylib class madrid_ribbon(IStrategy): INTERFACE_VERSION = 3 '\n Madrid Ribbon 001\n author@: Hessebo\n This strategy aims to follow emas.\n How to use it?\n\n ' INTERFACE_VERSION: int = 3 # Minimal ROI designed for the strategy. # This attribute will be overridden if the config file contains "minimal_roi" minimal_roi = {'60': 0.01, '30': 0.03, '20': 0.04, '0': 0.05} can_short = True # Optimal stoploss designed for the strategy # This attribute will be overridden if the config file contains "stoploss" stoploss = -0.1 # Optimal timeframe for the strategy timeframe = '15m' # trailing stoploss trailing_stop = False trailing_stop_positive = 0.01 trailing_stop_positive_offset = 0.02 use_custom_stoploss = True def custom_stoploss(self, pair: str, trade: 'Trade', current_time: datetime, current_rate: float, current_profit: float, **kwargs) -> float: # Calculate as `-desired_stop_from_open + current_profit` to get the distance between current_profit and initial price if current_profit > 0.3: return 0.01 elif current_profit > 0.1: return 0.015 elif current_profit > 0.06: return 0.01 elif current_profit > 0.02: return 0.05 elif current_profit > 0.01: return 0.003 return 0.15 # run "populate_indicators" only for new candle process_only_new_candles = False # Experimental settings (configuration will overide these if set) use_exit_signal = True exit_profit_only = False ignore_roi_if_entry_signal = False # Optional order type mapping order_types = {'entry': 'limit', 'exit': 'limit', 'stoploss': 'market', 'stoploss_on_exchange': False} use_custom_stoploss = False def custom_stoploss(self, pair: str, trade: 'Trade', current_time: datetime, current_rate: float, current_profit: float, **kwargs) -> float: # Calculate as `-desired_stop_from_open + current_profit` to get the distance between current_profit and initial price if current_profit > 0.3: return 0.01 elif current_profit > 0.1: return 0.015 elif current_profit > 0.06: return 0.01 elif current_profit > 0.02: return 0.05 elif current_profit > 0.01: return 0.003 return 0.15 def informative_pairs(self): """ Define additional, informative pair/interval combinations to be cached from the exchange. These pair/interval combinations are non-tradeable, unless they are part of the whitelist as well. For more information, please consult the documentation :return: List of tuples in the format (pair, interval) Sample: return [("ETH/USDT", "5m"), ("BTC/USDT", "15m"), ] """ return [] def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: """ Adds several different TA indicators to the given DataFrame Performance Note: For the best performance be frugal on the number of indicators you are using. Let uncomment only the indicator you are using in your strategies or your hyperopt configuration, otherwise you will waste your memory and CPU usage. """ bollinger = qtpylib.bollinger_bands(qtpylib.typical_price(dataframe), window=20, stds=2) dataframe['bb_lowerband'] = bollinger['lower'] dataframe['bb_middleband'] = bollinger['mid'] dataframe['bb_upperband'] = bollinger['upper'] stoch = ta.STOCH(dataframe, fastk_period=14, slowk_period=3, slowk_matype=0, slowd_period=3, slowd_matype=0) dataframe['slowd'] = stoch['slowd'] dataframe['slowk'] = stoch['slowk'] # MACD # https://mrjbq7.github.io/ta-lib/func_groups/momentum_indicators.html macd = ta.MACD(dataframe, fastperiod=12, fastmatype=0, slowperiod=26, slowmatype=0, signalperiod=9, signalmatype=0) dataframe['macd'] = macd['macd'] dataframe['macdsignal'] = macd['macdsignal'] dataframe['macdhist'] = macd['macdhist'] # print(metadata) # print(dataframe.tail(20)) dataframe['ema_madrid'] = ta.EMA(dataframe, timeperiod=10) dataframe['ema5'] = ta.EMA(dataframe, timeperiod=5) dataframe['ema10'] = ta.EMA(dataframe, timeperiod=10) dataframe['ema15'] = ta.EMA(dataframe, timeperiod=15) dataframe['ema20'] = ta.EMA(dataframe, timeperiod=20) dataframe['ema25'] = ta.EMA(dataframe, timeperiod=25) dataframe['ema30'] = ta.EMA(dataframe, timeperiod=30) dataframe['ema35'] = ta.EMA(dataframe, timeperiod=35) dataframe['ema40'] = ta.EMA(dataframe, timeperiod=40) dataframe['ema45'] = ta.EMA(dataframe, timeperiod=45) dataframe['ema50'] = ta.EMA(dataframe, timeperiod=50) dataframe['ema55'] = ta.EMA(dataframe, timeperiod=55) dataframe['ema60'] = ta.EMA(dataframe, timeperiod=60) dataframe['ema65'] = ta.EMA(dataframe, timeperiod=65) dataframe['ema70'] = ta.EMA(dataframe, timeperiod=70) dataframe['ema75'] = ta.EMA(dataframe, timeperiod=75) dataframe['ema80'] = ta.EMA(dataframe, timeperiod=80) dataframe['ema85'] = ta.EMA(dataframe, timeperiod=85) dataframe['ema90'] = ta.EMA(dataframe, timeperiod=90) dataframe['ema95'] = ta.EMA(dataframe, timeperiod=95) dataframe['ema100'] = ta.EMA(dataframe, timeperiod=100) dataframe['ema200'] = ta.EMA(dataframe, timeperiod=200) dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14) return dataframe def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: """ Based on TA indicators, populates the entry signal for the given dataframe :param dataframe: DataFrame :return: DataFrame with entry column """ # qtpylib.crossed_above(dataframe['ema5'], dataframe['ema20'].shift(1)) & # (dataframe['ema5'] > dataframe['ema_madrid']) & # (dataframe['ha_open'] < dataframe['ha_close'].shift(12)) # green bar dataframe.loc[(dataframe['rsi'] > 51) & (dataframe['ema5'] > dataframe['ema10']) & (dataframe['ema10'] > dataframe['ema15']) & (dataframe['ema15'] > dataframe['ema20']) & (dataframe['ema20'] > dataframe['ema25']) & (dataframe['ema25'] > dataframe['ema30']) & (dataframe['ema30'] > dataframe['ema35']) & (dataframe['ema35'] > dataframe['ema40']) & (dataframe['ema40'] > dataframe['ema45']) & (dataframe['ema45'] > dataframe['ema50']) & (dataframe['ema50'] > dataframe['ema55']) & (dataframe['ema55'] > dataframe['ema60']) & (dataframe['ema60'] > dataframe['ema65']) & (dataframe['ema65'] > dataframe['ema70']) & (dataframe['ema70'] > dataframe['ema75']) & (dataframe['ema75'] > dataframe['ema80']) & (dataframe['ema80'] > dataframe['ema85']) & (dataframe['ema85'] > dataframe['ema90']) & (dataframe['ema90'] > dataframe['ema95']) & (dataframe['ema95'] > dataframe['ema100']) & (dataframe['ema100'] > dataframe['ema200']) & (dataframe['close'] > dataframe['bb_middleband']), 'enter_long'] = 1 # Enter Short # qtpylib.crossed_above(dataframe['ema10'], dataframe['ema20']) & # (dataframe['ha_open'] < dataframe['ha_close'].shift(12)) # red bar dataframe.loc[(dataframe['rsi'] < 51) & (dataframe['ema5'] < dataframe['ema10']) & (dataframe['ema10'] < dataframe['ema15']) & (dataframe['ema15'] < dataframe['ema20']) & (dataframe['ema20'] < dataframe['ema25']) & (dataframe['ema25'] < dataframe['ema30']) & (dataframe['ema30'] < dataframe['ema35']) & (dataframe['ema35'] < dataframe['ema40']) & (dataframe['ema40'] < dataframe['ema45']) & (dataframe['ema45'] < dataframe['ema50']) & (dataframe['ema50'] < dataframe['ema55']) & (dataframe['ema55'] < dataframe['ema60']) & (dataframe['ema60'] < dataframe['ema65']) & (dataframe['ema65'] < dataframe['ema70']) & (dataframe['ema70'] < dataframe['ema75']) & (dataframe['ema75'] < dataframe['ema80']) & (dataframe['ema80'] < dataframe['ema85']) & (dataframe['ema85'] < dataframe['ema90']) & (dataframe['ema90'] < dataframe['ema95']) & (dataframe['ema95'] < dataframe['ema100']) & (dataframe['ema100'] < dataframe['ema200']) & (dataframe['close'] < dataframe['bb_middleband']), 'enter_short'] = 1 return dataframe def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: """ Based on TA indicators, populates the exit signal for the given dataframe :param dataframe: DataFrame :return: DataFrame with entry column """ # (dataframe['ha_close'] < dataframe['ema20']) & # (dataframe['ha_open'] > dataframe['ha_close']) # red bar dataframe.loc[qtpylib.crossed_above(dataframe['ema10'], dataframe['ema100']), 'exit_long'] = 1 # (dataframe['ha_close'] > dataframe['ema20']) & # (dataframe['ha_open'] < dataframe['ha_close']) # Green bar dataframe.loc[qtpylib.crossed_below(dataframe['ema10'], dataframe['ema100']), 'exit_short'] = 1 return dataframe |
Strategy League — fixed backtest that feeds the ranking
Export report Freqtrade logsRun finished · took 539.9s
ℹ️ 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 →
- statistically significant edge (p=0.00)
- 100% of resampled runs stayed profitable
- profitable across 93% 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 | 10 | -0.40 | -0.40 | 1 | 9 | 10.0 | -0.54 | 6h 06m |
| Dec 2025 | bearish trending low vol | 687 | +2.85 | 0.04 | 467 | 220 | 68.0 | -0.8 | 10h 52m |
| Nov 2025 | bearish trending high vol | 980 | +32.00 | 0.33 | 737 | 243 | 75.2 | -2.72 | 7h 14m |
| Oct 2025 | bearish trending low vol | 1013 | +21.87 | 0.21 | 744 | 269 | 73.4 | -3.09 | 7h 07m |
| Sep 2025 | bullish choppy low vol | 654 | +17.77 | 0.27 | 435 | 219 | 66.5 | -2.06 | 10h 49m |
| Aug 2025 | bearish choppy low vol | 785 | -9.22 | -0.12 | 568 | 217 | 72.4 | -1.94 | 9h 20m |
| Jul 2025 | bullish choppy low vol | 905 | +20.67 | 0.23 | 688 | 217 | 76.0 | -2.49 | 8h 12m |
| Jun 2025 | bearish choppy low vol | 641 | -12.00 | -0.19 | 411 | 230 | 64.1 | -2.2 | 11h 23m |
| May 2025 | bullish trending low vol | 824 | +7.29 | 0.09 | 603 | 221 | 73.2 | -1.5 | 8h 48m |
| Apr 2025 | bullish choppy low vol | 895 | +5.81 | 0.07 | 622 | 273 | 69.5 | -1.76 | 7h 45m |
| Mar 2025 | bearish trending high vol | 986 | -2.98 | -0.03 | 725 | 261 | 73.5 | -2.04 | 7h 31m |
| Feb 2025 | bearish trending low vol | 1004 | +51.57 | 0.52 | 779 | 225 | 77.6 | -2.07 | 6h 27m |
| Jan 2025 | bearish choppy low vol | 1047 | +8.23 | 0.08 | 802 | 245 | 76.6 | -2.11 | 6h 53m |
| Dec 2024 | bullish trending low vol | 1200 | +36.25 | 0.30 | 918 | 282 | 76.5 | -2.2 | 5h 59m |
| Nov 2024 | bullish trending low vol | 1181 | +25.51 | 0.22 | 925 | 256 | 78.3 | -1.65 | 6h 08m |
| Oct 2024 | bullish choppy low vol | 683 | +3.02 | 0.05 | 475 | 208 | 69.5 | -1.03 | 10h 52m |
| Sep 2024 | bearish choppy low vol | 677 | +11.18 | 0.17 | 475 | 202 | 70.2 | -0.53 | 10h 31m |
| Aug 2024 | bearish choppy high vol | 942 | +52.39 | 0.57 | 741 | 201 | 78.7 | -1.31 | 7h 32m |
| Jul 2024 | bearish trending low vol | 874 | +21.82 | 0.26 | 662 | 212 | 75.7 | -2.85 | 8h 23m |
| Jun 2024 | bearish choppy low vol | 722 | +13.03 | 0.19 | 502 | 220 | 69.5 | -2.73 | 9h 51m |
| May 2024 | bullish choppy high vol | 699 | -7.25 | -0.10 | 456 | 243 | 65.2 | -2.73 | 10h 33m |
| Apr 2024 | bearish choppy high vol | 1051 | +49.89 | 0.48 | 809 | 242 | 77.0 | -3.86 | 6h 51m |
| Mar 2024 | bullish trending high vol | 1053 | -5.18 | -0.07 | 769 | 284 | 73.0 | -5.47 | 6h 52m |
| Feb 2024 | bullish trending low vol | 719 | -2.72 | -0.03 | 480 | 239 | 66.8 | -2.81 | 9h 33m |
| Jan 2024 | bearish choppy high vol | 875 | +4.56 | 0.06 | 630 | 245 | 72.0 | -3.93 | 8h 26m |
| Dec 2023 | bullish trending low vol | 901 | -1.98 | -0.02 | 645 | 256 | 71.6 | -3.95 | 8h 19m |
| Nov 2023 | bullish trending low vol | 866 | -14.35 | -0.17 | 591 | 275 | 68.2 | -2.93 | 8h 16m |
| Oct 2023 | bullish trending low vol | 670 | +21.48 | 0.33 | 469 | 201 | 70.0 | -1.11 | 11h 05m |
| Sep 2023 | bearish choppy low vol | 559 | +3.45 | 0.06 | 322 | 237 | 57.6 | -1.95 | 12h 51m |
| Aug 2023 | bearish choppy low vol | 631 | +14.72 | 0.24 | 419 | 212 | 66.4 | -1.71 | 11h 52m |
| Jul 2023 | bullish trending low vol | 683 | +7.57 | 0.11 | 435 | 248 | 63.7 | -1.42 | 10h 41m |
| Jun 2023 | bullish trending low vol | 749 | +5.71 | 0.08 | 511 | 238 | 68.2 | -1.33 | 9h 38m |
| May 2023 | bearish choppy low vol | 522 | +4.98 | 0.10 | 331 | 191 | 63.4 | -0.71 | 13h 55m |
| Apr 2023 | bullish trending low vol | 646 | +9.34 | 0.15 | 421 | 225 | 65.2 | -2.91 | 10h 55m |
| Mar 2023 | bullish trending high vol | 844 | +10.37 | 0.13 | 607 | 237 | 71.9 | -2.09 | 8h 41m |
| Feb 2023 | bullish trending low vol | 731 | +9.20 | 0.12 | 520 | 211 | 71.1 | -1.31 | 9h 06m |
| Jan 2023 | bullish trending low vol | 890 | +29.75 | 0.34 | 639 | 251 | 71.8 | -1.09 | 8h 22m |
| Dec 2022 | bearish trending low vol | 629 | +13.94 | 0.22 | 411 | 218 | 65.3 | -2.25 | 11h 33m |
| Nov 2022 | bearish trending high vol | 1027 | +26.39 | 0.26 | 784 | 243 | 76.3 | -3.01 | 6h 42m |
| Oct 2022 | bullish choppy low vol | 696 | +6.06 | 0.09 | 489 | 207 | 70.3 | -2.16 | 10h 36m |
| Sep 2022 | bearish choppy high vol | 811 | -3.10 | -0.04 | 572 | 239 | 70.5 | -3.12 | 8h 44m |
| Aug 2022 | bullish choppy high vol | 831 | +16.87 | 0.21 | 597 | 234 | 71.8 | -1.34 | 8h 46m |
| Jul 2022 | bullish trending high vol | 1068 | +23.31 | 0.22 | 826 | 242 | 77.3 | -2.52 | 6h 46m |
| Jun 2022 | bearish trending high vol | 1425 | +35.22 | 0.26 | 1141 | 284 | 80.1 | -8.11 | 4h 48m |
| May 2022 | bearish trending high vol | 1434 | +39.15 | 0.29 | 1129 | 305 | 78.7 | -8.53 | 4h 49m |
| Apr 2022 | bearish choppy high vol | 897 | +19.48 | 0.22 | 669 | 228 | 74.6 | -2.68 | 7h 51m |
| Mar 2022 | bullish choppy high vol | 885 | +12.94 | 0.16 | 639 | 246 | 72.2 | -3.24 | 8h 10m |
| Feb 2022 | bearish trending high vol | 936 | +9.66 | 0.11 | 728 | 208 | 77.8 | -3.69 | 6h 51m |
| Jan 2022 | bearish trending high vol | 1217 | +38.78 | 0.33 | 948 | 269 | 77.9 | -6.89 | 5h 54m |
| Dec 2021 | bearish trending high vol | 1083 | +12.60 | 0.12 | 823 | 260 | 76.0 | -8.22 | 6h 41m |
| Nov 2021 | bearish trending high vol | 986 | +9.47 | 0.09 | 730 | 256 | 74.0 | -5.59 | 7h 13m |
| Oct 2021 | bullish trending high vol | 907 | -2.45 | -0.02 | 638 | 269 | 70.3 | -4.74 | 8h 15m |
| Sep 2021 | bearish trending high vol | 1281 | +16.02 | 0.12 | 1013 | 268 | 79.1 | -5.41 | 5h 20m |
| Aug 2021 | bullish trending high vol | 1188 | +3.05 | 0.02 | 907 | 281 | 76.3 | -6.92 | 6h 07m |
| Jul 2021 | bullish trending high vol | 1047 | +5.11 | 0.05 | 800 | 247 | 76.4 | -11.48 | 6h 52m |
| Jun 2021 | bearish trending high vol | 1437 | +38.57 | 0.27 | 1182 | 255 | 82.3 | -6.87 | 4h 38m |
| May 2021 | bearish trending high vol | 2375 | +85.89 | 0.37 | 1918 | 457 | 80.8 | -24.63 | 2h 48m |
| Apr 2021 | bearish choppy high vol | 1614 | +36.09 | 0.24 | 1280 | 334 | 79.3 | -10.24 | 4h 15m |
| Mar 2021 | bullish choppy high vol | 1194 | +5.84 | 0.05 | 899 | 295 | 75.3 | -12.85 | 6h 05m |
| Feb 2021 | bullish trending high vol | 1749 | +52.81 | 0.32 | 1414 | 335 | 80.8 | -15.7 | 3h 38m |
| Jan 2021 | bullish trending high vol | 1661 | +6.38 | 0.05 | 1326 | 335 | 79.8 | -18.61 | 3h 53m |
Yearly breakdown
| Year | Trades | Profit % | Avg % | Win | Loss | Win % | DD % | Avg dur |
|---|---|---|---|---|---|---|---|---|
| 2026 | 10 | -0.40 | -0.40 | 1 | 9 | 10.0 | -0.54 | 6h 06m |
| 2025 | 10421 | +143.86 | 0.14 | 7581 | 2840 | 72.7 | -3.09 | 8h 16m |
| 2024 | 10676 | +202.50 | 0.19 | 7842 | 2834 | 73.5 | -5.47 | 8h 06m |
| 2023 | 8692 | +100.24 | 0.12 | 5910 | 2782 | 68.0 | -3.95 | 10h 01m |
| 2022 | 11856 | +238.70 | 0.21 | 8933 | 2923 | 75.3 | -8.53 | 7h 09m |
| 2021 | 16522 | +269.38 | 0.17 | 12930 | 3592 | 78.3 | -24.63 | 5h 03m |
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 | |
|---|---|---|---|
| 12 | review | missing_startup_candles | uses recursive indicators (EMA, MACD, 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 EMA(timeperiod=200) needing 3x warmup, so it needs at least that many. Set it to a few times the longest period and confirm with `freqtrade recursive-analysis` |
| 54 | review | dead_callback | custom_stoploss() is defined but use_custom_stoploss isn't True, and freqtrade only calls it when that flag is set -- the method never runs and every trade uses the static stoploss |
| 45 | 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 logsno lookahead bias detected
20 signal(s) analysed · 0 biased entries · 0 biased exits
ran by Ron · took 210.6s