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 281 282 283 284 285 | from logging import FATAL from freqtrade.strategy.interface import IStrategy from typing import Dict, List from functools import reduce from pandas import DataFrame import talib.abstract as ta import numpy as np import freqtrade.vendor.qtpylib.indicators as qtpylib import datetime from technical.util import resample_to_interval, resampled_merge from datetime import datetime, timedelta from freqtrade.persistence import Trade from freqtrade.strategy import stoploss_from_open, merge_informative_pair, DecimalParameter, IntParameter, CategoricalParameter import technical.indicators as ftt def EWO(dataframe, ema_length=5, ema2_length=35): df = dataframe.copy() ema1 = ta.EMA(df, timeperiod=ema_length) ema2 = ta.EMA(df, timeperiod=ema2_length) emadif = (ema1 - ema2) / df['low'] * 100 return emadif class NASOSv7LongShort(IStrategy): INTERFACE_VERSION = 3 minimal_roi = { "0": 10 } # Adjust stoploss for both long and short stoploss = -0.15 # Parameters for both long and short entries base_nb_candles_buy = IntParameter(2, 20, default=8, space='buy', optimize=True) base_nb_candles_sell = IntParameter(2, 25, default=16, space='sell', optimize=True) # Long buy parameters long_low_offset = DecimalParameter(0.9, 0.99, default=0.984, space='buy', optimize=False) long_low_offset_2 = DecimalParameter(0.9, 0.99, default=0.942, space='buy', optimize=False) # Short sell parameters short_high_offset = DecimalParameter(0.95, 1.1, default=1.084, space='sell', optimize=True) short_high_offset_2 = DecimalParameter(0.99, 1.5, default=1.401, space='sell', optimize=True) fast_ewo = 50 slow_ewo = 200 lookback_candles = IntParameter(1, 24, default=3, space='buy', optimize=True) profit_threshold = DecimalParameter(1.0, 1.03, default=1.008, space='buy', optimize=True) # EWO parameters for both long and short ewo_low = DecimalParameter(-20.0, -8.0, default=-14.378, space='buy', optimize=False) ewo_high = DecimalParameter(2.0, 12.0, default=2.403, space='buy', optimize=False) ewo_high_2 = DecimalParameter(-6.0, 12.0, default=-5.585, space='buy', optimize=False) rsi_buy = IntParameter(50, 100, default=72, space='buy', optimize=False) # Custom stoploss parameters pHSL = DecimalParameter(-0.200, -0.040, default=-0.15, decimals=3, space='sell', optimize=False, load=True) pPF_1 = DecimalParameter(0.008, 0.020, default=0.016, decimals=3, space='sell', optimize=False, load=True) pSL_1 = DecimalParameter(0.008, 0.020, default=0.014, decimals=3, space='sell', optimize=False, load=True) pPF_2 = DecimalParameter(0.040, 0.100, default=0.024, decimals=3, space='sell', optimize=False, load=True) pSL_2 = DecimalParameter(0.020, 0.070, default=0.022, decimals=3, space='sell', optimize=False, load=True) trailing_stop = True trailing_stop_positive = 0.001 trailing_stop_positive_offset = 0.016 trailing_only_offset_is_reached = True use_exit_signal = True exit_profit_only = False exit_profit_offset = 0.01 ignore_roi_if_entry_signal = False timeframe = '5m' inf_1h = '1h' process_only_new_candles = True startup_candle_count = 200 use_custom_stoploss = False # Enable both long and short trading position_adjustment_enable = True max_entry_position_adjustment = 0 max_dist_to_main_market_price_pct = 0.002 plot_config = { 'main_plot': { 'ma_buy': {'color': 'orange'}, 'ma_sell': {'color': 'orange'}, }, } slippage_protection = { 'retries': 3, 'max_slippage': -0.02 } def custom_stoploss(self, pair: str, trade: 'Trade', current_time: datetime, current_rate: float, current_profit: float, **kwargs) -> float: HSL = self.pHSL.value PF_1 = self.pPF_1.value SL_1 = self.pSL_1.value PF_2 = self.pPF_2.value SL_2 = self.pSL_2.value if (current_profit > PF_2): sl_profit = SL_2 + (current_profit - PF_2) elif (current_profit > PF_1): sl_profit = SL_1 + ((current_profit - PF_1)*(SL_2 - SL_1)/(PF_2 - PF_1)) else: sl_profit = HSL return stoploss_from_open(sl_profit, current_profit) def confirm_trade_exit(self, pair: str, trade: Trade, order_type: str, amount: float, rate: float, time_in_force: str, sell_reason: str, current_time: datetime, **kwargs) -> bool: dataframe, _ = self.dp.get_analyzed_dataframe(pair, self.timeframe) last_candle = dataframe.iloc[-1] if (last_candle is not None): # Additional exit confirmation for both longs and shorts if (sell_reason in ['sell_signal']): if (last_candle['hma_50']*1.149 > last_candle['ema_100']) and (last_candle['close'] < last_candle['ema_100']*0.951): return False try: state = self.slippage_protection['__pair_retries'] except KeyError: state = self.slippage_protection['__pair_retries'] = {} candle = dataframe.iloc[-1].squeeze() slippage = (rate / candle['close']) - 1 if slippage < self.slippage_protection['max_slippage']: pair_retries = state.get(pair, 0) if pair_retries < self.slippage_protection['retries']: state[pair] = pair_retries + 1 return False state[pair] = 0 return True def informative_pairs(self): pairs = self.dp.current_whitelist() informative_pairs = [(pair, '1h') for pair in pairs] return informative_pairs def informative_1h_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: assert self.dp, "DataProvider is required for multiple timeframes." informative_1h = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe=self.inf_1h) return informative_1h def normal_tf_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: for val in self.base_nb_candles_buy.range: dataframe[f'ma_buy_{val}'] = ta.EMA(dataframe, timeperiod=val) for val in self.base_nb_candles_sell.range: dataframe[f'ma_sell_{val}'] = ta.EMA(dataframe, timeperiod=val) dataframe['hma_50'] = qtpylib.hull_moving_average(dataframe['close'], window=50) dataframe['ema_100'] = ta.EMA(dataframe, timeperiod=100) dataframe['sma_9'] = ta.SMA(dataframe, timeperiod=9) dataframe['EWO'] = EWO(dataframe, self.fast_ewo, self.slow_ewo) dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14) dataframe['rsi_fast'] = ta.RSI(dataframe, timeperiod=4) dataframe['rsi_slow'] = ta.RSI(dataframe, timeperiod=20) return dataframe def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: informative_1h = self.informative_1h_indicators(dataframe, metadata) dataframe = merge_informative_pair( dataframe, informative_1h, self.timeframe, self.inf_1h, ffill=True) dataframe = self.normal_tf_indicators(dataframe, metadata) return dataframe def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: dont_buy_conditions = [] dont_buy_conditions.append( ( (dataframe['close_1h'].rolling(self.lookback_candles.value).max() < (dataframe['close'] * self.profit_threshold.value)) ) ) # Long Entry Conditions (unchanged from original) dataframe.loc[ ( (dataframe['rsi_fast'] < 35) & (dataframe['close'] < (dataframe[f'ma_buy_{self.base_nb_candles_buy.value}'] * self.long_low_offset.value)) & (dataframe['EWO'] > self.ewo_high.value) & (dataframe['rsi'] < self.rsi_buy.value) & (dataframe['volume'] > 0) & (dataframe['close'] < ( dataframe[f'ma_sell_{self.base_nb_candles_sell.value}'] * self.short_high_offset.value)) ), ['enter_long', 'buy_tag']] = (1, 'ewo1') # Short Entry Conditions (new) dataframe.loc[ ( (dataframe['rsi_fast'] > 65) & (dataframe['close'] > (dataframe[f'ma_sell_{self.base_nb_candles_sell.value}'] * self.short_high_offset.value)) & (dataframe['EWO'] < self.ewo_low.value) & (dataframe['rsi'] > (100 - self.rsi_buy.value)) & (dataframe['volume'] > 0) & (dataframe['close'] > ( dataframe[f'ma_buy_{self.base_nb_candles_buy.value}'] * self.long_low_offset.value)) ), ['enter_short', 'sell_tag']] = (1, 'short_ewo') if dont_buy_conditions: for condition in dont_buy_conditions: dataframe.loc[condition, 'enter_long'] = 0 dataframe.loc[condition, 'enter_short'] = 0 return dataframe def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: # Long Exit Conditions long_conditions = [ ((dataframe['close'] > dataframe['sma_9']) & (dataframe['close'] > (dataframe[f'ma_sell_{self.base_nb_candles_sell.value}'] * self.short_high_offset_2.value)) & (dataframe['rsi'] > 50) & (dataframe['volume'] > 0) & (dataframe['rsi_fast'] > dataframe['rsi_slow']) ) | ( (dataframe['close'] < dataframe['hma_50']) & (dataframe['close'] > (dataframe[f'ma_sell_{self.base_nb_candles_sell.value}'] * self.short_high_offset.value)) & (dataframe['volume'] > 0) & (dataframe['rsi_fast'] > dataframe['rsi_slow']) ) ] # Short Exit Conditions short_conditions = [ ((dataframe['close'] < dataframe['sma_9']) & (dataframe['close'] < (dataframe[f'ma_buy_{self.base_nb_candles_buy.value}'] * self.long_low_offset.value)) & (dataframe['rsi'] < 50) & (dataframe['volume'] > 0) & (dataframe['rsi_fast'] < dataframe['rsi_slow']) ) | ( (dataframe['close'] > dataframe['hma_50']) & (dataframe['close'] < (dataframe[f'ma_buy_{self.base_nb_candles_buy.value}'] * self.long_low_offset_2.value)) & (dataframe['volume'] > 0) & (dataframe['rsi_fast'] < dataframe['rsi_slow']) ) ] # Set exit signals if long_conditions: dataframe.loc[ reduce(lambda x, y: x | y, long_conditions), 'exit_long' ] = 1 if short_conditions: dataframe.loc[ reduce(lambda x, y: x | y, short_conditions), 'exit_short' ] = 1 return dataframe |
Strategy League — fixed backtest that feeds the ranking
Export report Freqtrade logsRun finished · took 320.5s
ℹ️ 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 →
- did not beat simply holding the market
- statistically significant edge (p=0.00)
- 100% of resampled runs stayed profitable
- profitable across 83% 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 |
|---|---|---|---|---|---|---|---|---|---|
| Dec 2025 | bearish trending low vol | 4 | -0.88 | -2.21 | 3 | 1 | 75.0 | -2.5 | 96h 42m |
| Nov 2025 | bearish trending high vol | 82 | +7.08 | 0.86 | 76 | 6 | 92.7 | -3.95 | 5h 58m |
| Oct 2025 | bearish trending low vol | 24 | -7.85 | -3.27 | 18 | 6 | 75.0 | -3.88 | 4h 19m |
| Sep 2025 | bullish choppy low vol | 16 | -0.58 | -0.37 | 14 | 2 | 87.5 | -2.6 | 56h 18m |
| Aug 2025 | bullish choppy low vol | 3 | -1.18 | -3.95 | 2 | 1 | 66.7 | -2.02 | 13h 42m |
| Jul 2025 | bullish choppy low vol | 27 | +3.13 | 1.16 | 26 | 1 | 96.3 | -2.35 | 19h 39m |
| Jun 2025 | bearish choppy low vol | 8 | +0.92 | 1.14 | 7 | 1 | 87.5 | -2.56 | 14h 18m |
| May 2025 | bullish trending low vol | 36 | +1.22 | 0.34 | 33 | 3 | 91.7 | -2.85 | 7h 25m |
| Apr 2025 | bullish choppy low vol | 7 | -1.99 | -2.85 | 5 | 2 | 71.4 | -3.03 | 12h 39m |
| Mar 2025 | bearish trending high vol | 15 | -4.12 | -2.74 | 11 | 4 | 73.3 | -2.47 | 22h 55m |
| Feb 2025 | bearish trending low vol | 11 | -1.48 | -1.34 | 9 | 2 | 81.8 | -1.48 | 11h 58m |
| Jan 2025 | bearish choppy low vol | 20 | +1.09 | 0.55 | 18 | 2 | 90.0 | -1.35 | 10h 14m |
| Dec 2024 | bullish trending low vol | 97 | +6.21 | 0.64 | 90 | 7 | 92.8 | -1.39 | 7h 39m |
| Nov 2024 | bullish trending low vol | 205 | +30.06 | 1.47 | 199 | 6 | 97.1 | -1.02 | 8h 10m |
| Oct 2024 | bullish choppy low vol | 2 | +0.35 | 1.73 | 2 | 0 | 100.0 | -1.12 | 26h 20m |
| Sep 2024 | bearish choppy low vol | 2 | +0.50 | 2.51 | 2 | 0 | 100.0 | -1.23 | 24h 10m |
| Aug 2024 | bearish choppy high vol | 5 | +1.07 | 2.14 | 5 | 0 | 100.0 | -1.51 | 1h 49m |
| Jul 2024 | bearish trending low vol | 8 | +1.34 | 1.68 | 8 | 0 | 100.0 | -1.85 | 2h 09m |
| Jun 2024 | bearish choppy low vol | 6 | -1.03 | -1.72 | 5 | 1 | 83.3 | -2.1 | 17h 05m |
| May 2024 | bullish choppy high vol | 6 | +1.24 | 2.07 | 6 | 0 | 100.0 | -1.9 | 8h 20m |
| Apr 2024 | bearish choppy high vol | 15 | -0.36 | -0.24 | 13 | 2 | 86.7 | -2.24 | 7h 46m |
| Mar 2024 | bullish trending high vol | 50 | -4.63 | -0.93 | 42 | 8 | 84.0 | -1.94 | 8h 14m |
| Feb 2024 | bullish trending low vol | 32 | +7.47 | 2.33 | 32 | 0 | 100.0 | -0.82 | 7h 04m |
| Jan 2024 | bearish choppy high vol | 49 | -2.78 | -0.57 | 42 | 7 | 85.7 | -1.33 | 20h 51m |
| Dec 2023 | bullish trending low vol | 80 | +11.43 | 1.43 | 78 | 2 | 97.5 | -0.69 | 7h 26m |
| Nov 2023 | bullish trending low vol | 39 | +2.17 | 0.55 | 36 | 3 | 92.3 | -0.81 | 7h 03m |
| Oct 2023 | bullish trending low vol | 10 | +0.24 | 0.24 | 9 | 1 | 90.0 | -0.4 | 27h 30m |
| Sep 2023 | bearish choppy low vol | 8 | +1.46 | 1.82 | 8 | 0 | 100.0 | -0.31 | 1h 02m |
| Aug 2023 | bearish choppy low vol | 21 | -0.31 | -0.15 | 18 | 3 | 85.7 | -0.76 | 13h 30m |
| Jul 2023 | bullish trending low vol | 26 | +5.22 | 2.01 | 26 | 0 | 100.0 | 0.0 | 16h 27m |
| Jun 2023 | bullish trending low vol | 37 | +6.79 | 1.83 | 36 | 1 | 97.3 | -0.41 | 5h 16m |
| May 2023 | bearish choppy low vol | 2 | +0.39 | 1.96 | 2 | 0 | 100.0 | 0.0 | 2h 55m |
| Apr 2023 | bullish trending low vol | 10 | +1.90 | 1.90 | 10 | 0 | 100.0 | -0.21 | 1h 50m |
| Mar 2023 | bullish trending high vol | 27 | +1.74 | 0.64 | 25 | 2 | 92.6 | -0.48 | 9h 15m |
| Feb 2023 | bullish trending low vol | 23 | +2.46 | 1.07 | 22 | 1 | 95.7 | -0.42 | 9h 46m |
| Jan 2023 | bullish trending low vol | 63 | +10.80 | 1.71 | 61 | 2 | 96.8 | -1.7 | 18h 04m |
| Dec 2022 | bearish trending low vol | 1 | -1.51 | -15.13 | 0 | 1 | 0.0 | -1.75 | 51h 30m |
| Nov 2022 | bearish trending high vol | 42 | +0.85 | 0.20 | 37 | 5 | 88.1 | -2.48 | 8h 18m |
| Oct 2022 | bullish choppy low vol | 16 | +1.45 | 0.90 | 15 | 1 | 93.8 | -2.35 | 9h 55m |
| Sep 2022 | bearish choppy high vol | 13 | -4.01 | -3.09 | 9 | 4 | 69.2 | -2.02 | 49h 56m |
| Aug 2022 | bullish choppy high vol | 25 | -1.76 | -0.70 | 21 | 4 | 84.0 | -1.23 | 11h 32m |
| Jul 2022 | bearish trending high vol | 53 | +8.82 | 1.66 | 51 | 2 | 96.2 | -0.43 | 5h 31m |
| Jun 2022 | bearish trending high vol | 72 | +4.07 | 0.56 | 65 | 7 | 90.3 | -2.67 | 7h 07m |
| May 2022 | bearish trending high vol | 57 | +3.70 | 0.65 | 52 | 5 | 91.2 | -1.69 | 15h 33m |
| Apr 2022 | bearish choppy high vol | 15 | -1.99 | -1.33 | 12 | 3 | 80.0 | -1.05 | 7h 43m |
| Mar 2022 | bullish choppy high vol | 18 | +3.89 | 2.16 | 18 | 0 | 100.0 | 0.0 | 4h 39m |
| Feb 2022 | bearish trending high vol | 35 | +5.23 | 1.49 | 33 | 2 | 94.3 | -0.46 | 3h 44m |
| Jan 2022 | bearish trending high vol | 15 | +3.47 | 2.32 | 15 | 0 | 100.0 | -0.72 | 3h 44m |
| Dec 2021 | bearish trending high vol | 29 | +3.03 | 1.05 | 27 | 2 | 93.1 | -1.69 | 7h 20m |
| Nov 2021 | bullish trending high vol | 30 | -2.53 | -0.84 | 25 | 5 | 83.3 | -1.9 | 25h 44m |
| Oct 2021 | bullish trending high vol | 34 | +1.17 | 0.34 | 31 | 3 | 91.2 | -1.17 | 5h 44m |
| Sep 2021 | bearish trending high vol | 111 | +7.28 | 0.66 | 102 | 9 | 91.9 | -1.86 | 6h 03m |
| Aug 2021 | bullish trending high vol | 86 | +14.98 | 1.74 | 84 | 2 | 97.7 | -0.48 | 4h 49m |
| Jul 2021 | bearish trending high vol | 61 | +4.62 | 0.76 | 57 | 4 | 93.4 | -1.71 | 17h 06m |
| Jun 2021 | bearish trending high vol | 69 | +2.97 | 0.43 | 63 | 6 | 91.3 | -2.13 | 7h 58m |
| May 2021 | bearish trending high vol | 449 | +41.81 | 0.93 | 422 | 27 | 94.0 | -3.05 | 2h 17m |
| Apr 2021 | bearish choppy high vol | 314 | +22.80 | 0.73 | 292 | 22 | 93.0 | -3.58 | 2h 23m |
| Mar 2021 | bullish choppy high vol | 134 | +11.11 | 0.83 | 125 | 9 | 93.3 | -2.71 | 4h 08m |
| Feb 2021 | bullish trending high vol | 468 | +42.47 | 0.91 | 441 | 27 | 94.2 | -2.89 | 3h 18m |
| Jan 2021 | bullish trending high vol | 597 | +74.41 | 1.25 | 571 | 26 | 95.6 | -8.62 | 2h 13m |
Yearly breakdown
| Year | Trades | Profit % | Avg % | Win | Loss | Win % | DD % | Avg dur |
|---|---|---|---|---|---|---|---|---|
| 2025 | 253 | -4.64 | -0.18 | 222 | 31 | 87.7 | -3.95 | 14h 14m |
| 2024 | 477 | +39.44 | 0.83 | 446 | 31 | 93.5 | -2.24 | 9h 23m |
| 2023 | 346 | +44.29 | 1.28 | 331 | 15 | 95.7 | -1.7 | 10h 41m |
| 2022 | 362 | +22.21 | 0.61 | 328 | 34 | 90.6 | -2.67 | 9h 52m |
| 2021 | 2382 | +224.12 | 0.94 | 2240 | 142 | 94.0 | -8.62 | 3h 48m |
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 | |
|---|---|---|---|
| 110 | 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 |
| 220 | review | short_without_can_short | writes enter_short, exit_short but can_short isn't True, so freqtrade never opens a short (it also requires futures/margin mode). Worse, freqtrade only takes a long when `not any([exit_long, enter_short])`, so every row you mark enter_short SUPPRESSES that candle's long entry and opens nothing in its place. |
ran by Ron · took s
Lookahead analysis
freqtrade lookahead-analysis: detects strategies peeking at future candles.