ComboHold
♡
Basics
mode: spot
outdated
Settings
trailing
hyperopt
hyperopt params: 10
Indicators
ADX
EMA
MACD
MFI
RSI
SAR
SMA
Stochastic
talib
Concepts
trailing
Methods
BBBHold_conditions
BTCJump_conditions
BTCNDrop_conditions
BTCNSeq_conditions
BigDrop_conditions
EMABounce_conditions
FisherBB_conditions
MACDCross_conditions
NDrop_conditions
NSeq_conditions
roi_space
Other
Config
5 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 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | # --- Do not remove these libs --- 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 freqtrade.vendor.qtpylib.indicators as qtpylib import numpy # noqa from freqtrade.strategy.hyper import CategoricalParameter, DecimalParameter, IntParameter import math from freqtrade.optimize.space import Categorical, Dimension, Integer, SKDecimal, Real # noqa from freqtrade.strategy.strategy_helper import merge_informative_pair #from user_data.strategies import Config import Config class ComboHold(IStrategy): """ Combines several buy strategies, and just holds until ROI kicks in This version doesn't issue a sell signal, just holds until ROI or stoploss kicks in How to use it? > python3 ./freqtrade/main.py -s ComboHold """ # Hyperparameters # Buy hyperspace params: buy_params = Config.strategyParameters["ComboHold"] print("Exchange: ", Config.exchange_name) buy_bbbhold_enabled = CategoricalParameter([True, False], default=True, space="buy") buy_bigdrop_enabled = CategoricalParameter([True, False], default=False, space="buy") buy_btcjump_enabled = CategoricalParameter([True, False], default=False, space="buy") buy_btcndrop_enabled = CategoricalParameter([True, False], default=False, space="buy") buy_btcnseq_enabled = CategoricalParameter([True, False], default=False, space="buy") buy_emabounce_enabled = CategoricalParameter([True, False], default=True, space="buy") buy_macdcross_enabled = CategoricalParameter([True, False], default=False, space="buy") buy_fisherbb_enabled = CategoricalParameter([True, False], default=True, space="buy") buy_ndrop_enabled = CategoricalParameter([True, False], default=True, space="buy") buy_nseq_enabled = CategoricalParameter([True, False], default=False, space="buy") # The following were hyperparameters for each individual strategy, but we are just making them constants here # This is so that we can run hyperopt and stand a chance of getting decent results (otherwise the search space # is too large) # NOTE: the strategies run differently in combination, so sometimes the best settings for the individual # strategy do not work well when used here # Organise alphabetically, so that it's easier to update based on hyperopt runs # parameters are defined in ComboHoldParams for easier update # BBBHold buy_bbbhold_bb_gain = Config.strategyParameters["BBBHold"]["buy_bb_gain"] buy_bbbhold_fisher = Config.strategyParameters["BBBHold"]["buy_fisher"] buy_bbbhold_fisher_enabled = Config.strategyParameters["BBBHold"]["buy_fisher_enabled"] buy_bbbhold_mfi = Config.strategyParameters["BBBHold"]["buy_mfi"] buy_bbbhold_mfi_enabled = Config.strategyParameters["BBBHold"]["buy_mfi_enabled"] # BigDrop buy_bigdrop_bb_enabled = Config.strategyParameters["BigDrop"]["buy_bb_enabled"] buy_bigdrop_drop = Config.strategyParameters["BigDrop"]["buy_drop"] buy_bigdrop_fisher = Config.strategyParameters["BigDrop"]["buy_fisher"] buy_bigdrop_fisher_enabled = Config.strategyParameters["BigDrop"]["buy_fisher_enabled"] buy_bigdrop_mfi = Config.strategyParameters["BigDrop"]["buy_mfi"] buy_bigdrop_mfi_enabled = Config.strategyParameters["BigDrop"]["buy_mfi_enabled"] buy_bigdrop_num_candles = Config.strategyParameters["BigDrop"]["buy_num_candles"] # BTCJump buy_btcjump_bb_gain = Config.strategyParameters["BTCJump"]["buy_bb_gain"] buy_btcjump_btc_jump = Config.strategyParameters["BTCJump"]["buy_btc_jump"] buy_btcjump_fisher = Config.strategyParameters["BTCJump"]["buy_fisher"] # BTCNDrop buy_btcndrop_bb_enabled = Config.strategyParameters["BTCNDrop"]["buy_bb_enabled"] buy_btcndrop_drop = Config.strategyParameters["BTCNDrop"]["buy_drop"] buy_btcndrop_fisher = Config.strategyParameters["BTCNDrop"]["buy_fisher"] buy_btcndrop_fisher_enabled = Config.strategyParameters["BTCNDrop"]["buy_fisher_enabled"] buy_btcndrop_mfi = Config.strategyParameters["BTCNDrop"]["buy_mfi"] buy_btcndrop_mfi_enabled = Config.strategyParameters["BTCNDrop"]["buy_mfi_enabled"] buy_btcndrop_num_candles = Config.strategyParameters["BTCNDrop"]["buy_num_candles"] # BTCNSeq buy_btcnseq_bb_enabled = Config.strategyParameters["BTCNSeq"]["buy_bb_enabled"] buy_btcnseq_bb_gain = Config.strategyParameters["BTCNSeq"]["buy_bb_gain"] buy_btcnseq_drop = Config.strategyParameters["BTCNSeq"]["buy_drop"] buy_btcnseq_fisher = Config.strategyParameters["BTCNSeq"]["buy_fisher"] buy_btcnseq_fisher_enabled = Config.strategyParameters["BTCNSeq"]["buy_fisher_enabled"] buy_btcnseq_num_candles = Config.strategyParameters["BTCNSeq"]["buy_num_candles"] # EMABounce buy_emabounce_long_period = Config.strategyParameters["EMABounce"]["buy_long_period"] buy_emabounce_short_period = Config.strategyParameters["EMABounce"]["buy_short_period"] buy_emabounce_diff = Config.strategyParameters["EMABounce"]["buy_diff"] # FisherBB buy_fisherbb_bb_gain = Config.strategyParameters["FisherBB"]["buy_bb_gain"] buy_fisherbb_fisher = Config.strategyParameters["FisherBB"]["buy_fisher"] # MACDCross buy_macdcross_adx = Config.strategyParameters["MACDCross"]["buy_adx"] buy_macdcross_adx_enabled = Config.strategyParameters["MACDCross"]["buy_adx_enabled"] buy_macdcross_bb_enabled = Config.strategyParameters["MACDCross"]["buy_bb_enabled"] buy_macdcross_bb_gain = Config.strategyParameters["MACDCross"]["buy_bb_gain"] buy_macdcross_dm_enabled = Config.strategyParameters["MACDCross"]["buy_dm_enabled"] buy_macdcross_fisher = Config.strategyParameters["MACDCross"]["buy_fisher"] buy_macdcross_fisher_enabled = Config.strategyParameters["MACDCross"]["buy_fisher_enabled"] buy_macdcross_mfi = Config.strategyParameters["MACDCross"]["buy_mfi"] buy_macdcross_mfi_enabled = Config.strategyParameters["MACDCross"]["buy_mfi_enabled"] buy_macdcross_neg_macd_enabled = Config.strategyParameters["MACDCross"]["buy_neg_macd_enabled"] buy_macdcross_period = Config.strategyParameters["MACDCross"]["buy_period"] buy_macdcross_sar_enabled = Config.strategyParameters["MACDCross"]["buy_sar_enabled"] # NDrop buy_ndrop_bb_enabled = Config.strategyParameters["NDrop"]["buy_bb_enabled"] buy_ndrop_drop = Config.strategyParameters["NDrop"]["buy_drop"] buy_ndrop_fisher = Config.strategyParameters["NDrop"]["buy_fisher"] buy_ndrop_fisher_enabled = Config.strategyParameters["NDrop"]["buy_fisher_enabled"] buy_ndrop_mfi = Config.strategyParameters["NDrop"]["buy_mfi"] buy_ndrop_mfi_enabled = Config.strategyParameters["NDrop"]["buy_mfi_enabled"] buy_ndrop_num_candles = Config.strategyParameters["NDrop"]["buy_num_candles"] # NSeq buy_nseq_bb_enabled = Config.strategyParameters["NSeq"]["buy_bb_enabled"] buy_nseq_drop = Config.strategyParameters["NSeq"]["buy_drop"] buy_nseq_fisher = Config.strategyParameters["NSeq"]["buy_fisher"] buy_nseq_fisher_enabled = Config.strategyParameters["NSeq"]["buy_fisher_enabled"] buy_nseq_mfi = Config.strategyParameters["NSeq"]["buy_mfi"] buy_nseq_mfi_enabled = Config.strategyParameters["NSeq"]["buy_mfi_enabled"] buy_nseq_num_candles = Config.strategyParameters["NSeq"]["buy_num_candles"] # Strategy Configuration # set the startup candles count to the longest average used (EMA, EMA etc) startup_candle_count = max(buy_emabounce_long_period, 20) # set common parameters minimal_roi = Config.minimal_roi trailing_stop = Config.trailing_stop trailing_stop_positive = Config.trailing_stop_positive trailing_stop_positive_offset = Config.trailing_stop_positive_offset trailing_only_offset_is_reached = Config.trailing_only_offset_is_reached stoploss = Config.stoploss timeframe = Config.timeframe process_only_new_candles = Config.process_only_new_candles use_sell_signal = Config.use_sell_signal sell_profit_only = Config.sell_profit_only ignore_roi_if_buy_signal = Config.ignore_roi_if_buy_signal order_types = Config.order_types # Define custom ROI ranges class HyperOpt: # Define a custom ROI space. def roi_space() -> List[Dimension]: return [ Integer(10, 240, name='roi_t1'), Integer(10, 120, name='roi_t2'), Integer(10, 80, name='roi_t3'), SKDecimal(0.01, 0.04, decimals=3, name='roi_p1'), SKDecimal(0.01, 0.07, decimals=3, name='roi_p2'), SKDecimal(0.01, 0.20, decimals=3, name='roi_p3'), ] 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. """ # BTC data # NOTE: we are applying this to the BTC/USD dataframe, not the normal dataframe (or in addition to anyway) if not self.dp: # Don't do anything if DataProvider is not available. return dataframe # get BTC dataframe inf_tf = '5m' btc_dataframe = self.dp.get_pair_dataframe(pair=Config.informative_pair, timeframe=inf_tf) # merge into main dataframe. This will create columns with a "_5m" suffix for the BTC data dataframe = merge_informative_pair(dataframe, btc_dataframe, self.timeframe, "5m", ffill=True) # BTC gain dataframe['btc_gain'] = (dataframe['close_5m'] - dataframe['open_5m']) / dataframe['open_5m'] dataframe['btc_zgain'] = dataframe['btc_gain'] - self.buy_btcjump_btc_jump # ADX dataframe['adx'] = ta.ADX(dataframe) # Plus Directional Indicator / Movement dataframe['dm_plus'] = ta.PLUS_DM(dataframe) dataframe['di_plus'] = ta.PLUS_DI(dataframe) # Minus Directional Indicator / Movement dataframe['dm_minus'] = ta.MINUS_DM(dataframe) dataframe['di_minus'] = ta.MINUS_DI(dataframe) dataframe['dm_delta'] = dataframe['dm_plus'] - dataframe['dm_minus'] dataframe['di_delta'] = dataframe['di_plus'] - dataframe['di_minus'] # MFI dataframe['mfi'] = ta.MFI(dataframe) # SMA - Simple Moving Average dataframe['sma'] = ta.SMA(dataframe, timeperiod=40) # MACD macd = ta.MACD(dataframe) dataframe['macd'] = macd['macd'] dataframe['macdsignal'] = macd['macdsignal'] # Stoch fast stoch_fast = ta.STOCHF(dataframe) dataframe['fastd'] = stoch_fast['fastd'] dataframe['fastk'] = stoch_fast['fastk'] # RSI dataframe['rsi'] = ta.RSI(dataframe) # Inverse Fisher transform on RSI, values [-1.0, 1.0] (https://goo.gl/2JGGoy) rsi = 0.1 * (dataframe['rsi'] - 50) dataframe['fisher_rsi'] = (numpy.exp(2 * rsi) - 1) / (numpy.exp(2 * rsi) + 1) # Bollinger bands #bollinger = qtpylib.bollinger_bands(qtpylib.typical_price(dataframe), window=20, stds=2) bollinger = qtpylib.weighted_bollinger_bands(qtpylib.typical_price(dataframe), window=20, stds=2) dataframe['bb_upperband'] = bollinger['upper'] dataframe['bb_middleband'] = bollinger['mid'] dataframe['bb_lowerband'] = bollinger['lower'] dataframe["bb_gain"] = ((dataframe["bb_upperband"] - dataframe["close"]) / dataframe["close"]) # EMA - Exponential Moving Average dataframe['ema5'] = ta.EMA(dataframe, timeperiod=5) dataframe['ema10'] = ta.EMA(dataframe, timeperiod=10) dataframe['ema50'] = ta.EMA(dataframe, timeperiod=50) dataframe['ema100'] = ta.EMA(dataframe, timeperiod=100) dataframe['ema'] = ta.EMA(dataframe, timeperiod=self.buy_emabounce_long_period) dataframe['ema_short'] = ta.EMA(dataframe, timeperiod=self.buy_emabounce_short_period) dataframe['ema_angle'] = ta.LINEARREG_SLOPE(dataframe['ema_short'], timeperiod=3) / (2.0 * math.pi) dataframe['ema_diff'] = (((dataframe['ema'] - dataframe['close']) / dataframe['ema'])) \ - self.buy_emabounce_diff # SAR Parabol dataframe['sar'] = ta.SAR(dataframe) return dataframe def NDrop_conditions(self, dataframe: DataFrame): conditions = [] # GUARDS AND TRENDS if self.buy_ndrop_mfi_enabled: conditions.append(dataframe['mfi'] <= self.buy_ndrop_mfi) if self.buy_ndrop_fisher_enabled: conditions.append(dataframe['fisher_rsi'] < self.buy_ndrop_fisher) if self.buy_ndrop_bb_enabled: conditions.append(dataframe['close'] <= dataframe['bb_lowerband']) # TRIGGERS # N red candles if self.buy_ndrop_num_candles >= 1: for i in range(self.buy_ndrop_num_candles): conditions.append(dataframe['close'].shift(i) <= dataframe['open'].shift(i)) # big enough drop? conditions.append( (((dataframe['open'].shift(self.buy_ndrop_num_candles - 1) - dataframe['close']) / dataframe['open'].shift(self.buy_ndrop_num_candles - 1)) >= self.buy_ndrop_drop) ) return conditions def NSeq_conditions(self, dataframe: DataFrame): conditions = [] # GUARDS AND TRENDS if self.buy_nseq_mfi_enabled: conditions.append(dataframe['mfi'] <= self.buy_nseq_mfi) if self.buy_nseq_fisher_enabled: conditions.append(dataframe['fisher_rsi'] < self.buy_nseq_fisher) if self.buy_nseq_bb_enabled: conditions.append(dataframe['close'] <= dataframe['bb_lowerband']) # TRIGGERS # current candle is green conditions.append(dataframe['close'] >= dataframe['open']) # N red candles if self.buy_nseq_num_candles >= 1: for i in range(self.buy_nseq_num_candles): conditions.append(dataframe['close'].shift(i+1) <= dataframe['open'].shift(i+1)) # big enough drop? conditions.append( (((dataframe['open'].shift(self.buy_nseq_num_candles) - dataframe['close']) / dataframe['open'].shift(self.buy_nseq_num_candles)) >= self.buy_nseq_drop) ) return conditions def EMABounce_conditions(self, dataframe: DataFrame): conditions = [] # GUARDS AND TRENDS # TRIGGERS # EMA flattened? conditions.append(qtpylib.crossed_above(dataframe['ema_angle'], 0)) # buy if price is far enough below EMA conditions.append(dataframe['ema_diff'] > 0.0) return conditions def MACDCross_conditions(self, dataframe: DataFrame): conditions = [] # GUARDS AND TRENDS if self.buy_macdcross_adx_enabled: conditions.append(dataframe['adx'] >= self.buy_macdcross_adx) if self.buy_macdcross_dm_enabled: conditions.append(dataframe['dm_delta'] > 0) if self.buy_macdcross_mfi_enabled: conditions.append(dataframe['mfi'] > self.buy_macdcross_mfi) # only buy if close is below SAR if self.buy_macdcross_sar_enabled: conditions.append(dataframe['close'] < dataframe['sar']) if self.buy_macdcross_fisher_enabled: conditions.append(dataframe['fisher_rsi'] < self.buy_macdcross_fisher) if self.buy_macdcross_neg_macd_enabled: conditions.append(dataframe['macd'] < 0.0) # potential gain > goal if self.buy_macdcross_bb_enabled: conditions.append(dataframe['bb_gain'] >= self.buy_macdcross_bb_gain) # Triggers conditions.append(qtpylib.crossed_above(dataframe['macd'], dataframe['macdsignal'])) # check that volume is not 0 conditions.append(dataframe['volume'] > 0) return conditions def BigDrop_conditions(self, dataframe: DataFrame): conditions = [] # GUARDS AND TRENDS if self.buy_bigdrop_mfi_enabled: conditions.append(dataframe['mfi'] <= self.buy_bigdrop_mfi) if self.buy_bigdrop_fisher_enabled: conditions.append(dataframe['fisher_rsi'] < self.buy_bigdrop_fisher) if self.buy_bigdrop_bb_enabled: conditions.append(dataframe['close'] <= dataframe['bb_lowerband']) # TRIGGERS # big enough drop? conditions.append( (((dataframe['open'].shift(self.buy_bigdrop_num_candles - 1) - dataframe['close']) / dataframe['open'].shift(self.buy_bigdrop_num_candles - 1)) >= self.buy_bigdrop_drop) ) return conditions def FisherBB_conditions(self, dataframe: DataFrame): conditions = [] # GUARDS AND TRENDS conditions.append(dataframe['fisher_rsi'] <= self.buy_fisherbb_fisher) conditions.append(dataframe['bb_gain'] >= self.buy_fisherbb_bb_gain) # TRIGGERS # none for this strategy, just guards return conditions def BBBHold_conditions(self, dataframe: DataFrame): conditions = [] # GUARDS AND TRENDS if self.buy_bbbhold_mfi_enabled: conditions.append(dataframe['mfi'] <= self.buy_bbbhold_mfi) if self.buy_bbbhold_fisher_enabled: conditions.append(dataframe['fisher_rsi'] < self.buy_bbbhold_fisher) # check that volume is not 0 conditions.append(dataframe['volume'] > 0) # TRIGGERS # potential gain > goal conditions.append(dataframe['bb_gain'] >= self.buy_bbbhold_bb_gain) # current candle is green conditions.append(dataframe['close'] > dataframe['open']) # candle crosses lower BB boundary conditions.append( (dataframe['open'] < dataframe['bb_lowerband']) & (dataframe['close'] >= dataframe['bb_lowerband']) ) return conditions def BTCNDrop_conditions(self, dataframe: DataFrame): conditions = [] # GUARDS AND TRENDS if self.buy_btcndrop_mfi_enabled: conditions.append(dataframe['mfi'] <= self.buy_btcndrop_mfi) if self.buy_btcndrop_fisher_enabled: conditions.append(dataframe['fisher_rsi'] <= self.buy_btcndrop_fisher) if self.buy_btcndrop_bb_enabled: conditions.append(dataframe['close'] <= dataframe['bb_lowerband']) # TRIGGERS # N red candles in BTC (not the current pair) if self.buy_btcndrop_num_candles >= 1: for i in range(self.buy_btcndrop_num_candles): conditions.append(dataframe['close_5m'].shift(i) <= dataframe['open_5m'].shift(i)) # big enough drop? conditions.append( (((dataframe['open_5m'].shift(self.buy_btcndrop_num_candles-1) - dataframe['close_5m']) / dataframe['open_5m'].shift(self.buy_btcndrop_num_candles-1)) >= self.buy_btcndrop_drop) ) return conditions def BTCNSeq_conditions(self, dataframe: DataFrame): conditions = [] # GUARDS AND TRENDS if self.buy_btcnseq_fisher_enabled: conditions.append(dataframe['fisher_rsi'] <= self.buy_btcnseq_fisher) if self.buy_btcnseq_bb_enabled: conditions.append(dataframe['bb_gain'] >= self.buy_btcnseq_bb_gain) # TRIGGERS # Green candle preceeded by N red candles in BTC (not the current pair) conditions.append(dataframe['close_5m'] > dataframe['open_5m']) if self.buy_btcnseq_num_candles >= 1: for i in range(self.buy_btcnseq_num_candles): conditions.append(dataframe['close_5m'].shift(i+1) <= dataframe['open_5m'].shift(i+1)) # big enough drop? conditions.append( (((dataframe['open_5m'].shift(self.buy_btcnseq_num_candles-1) - dataframe['close_5m']) / dataframe['open_5m'].shift(self.buy_btcnseq_num_candles-1)) >= self.buy_btcnseq_drop) ) return conditions def BTCJump_conditions(self, dataframe: DataFrame): conditions = [] # GUARDS AND TRENDS conditions.append(dataframe['fisher_rsi'] <= self.buy_btcjump_fisher) conditions.append(dataframe['bb_gain'] >= self.buy_btcjump_bb_gain) # TRIGGERS # did BTC gain exceed target? conditions.append(qtpylib.crossed_above(dataframe['btc_zgain'], 0)) return conditions def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: # build the dataframe using the conditions # AND together the conditions for each strategy conditions = [] c = [] if self.buy_ndrop_enabled.value: c = self.NDrop_conditions(dataframe) if c: conditions.append(reduce(lambda x, y: x & y, c)) if self.buy_nseq_enabled.value: c = self.NSeq_conditions(dataframe) if c: conditions.append(reduce(lambda x, y: x & y, c)) if self.buy_emabounce_enabled.value: c = self.EMABounce_conditions(dataframe) if c: conditions.append(reduce(lambda x, y: x & y, c)) if self.buy_macdcross_enabled.value: c = self.MACDCross_conditions(dataframe) if c: conditions.append(reduce(lambda x, y: x & y, c)) if self.buy_bigdrop_enabled.value: c = self.BigDrop_conditions(dataframe) if c: conditions.append(reduce(lambda x, y: x & y, c)) if self.buy_fisherbb_enabled.value: c = self.FisherBB_conditions(dataframe) if c: conditions.append(reduce(lambda x, y: x & y, c)) if self.buy_bbbhold_enabled.value: c = self.BBBHold_conditions(dataframe) if c: conditions.append(reduce(lambda x, y: x & y, c)) if self.buy_btcndrop_enabled.value: c = self.BTCNDrop_conditions(dataframe) if c: conditions.append(reduce(lambda x, y: x & y, c)) if self.buy_btcnseq_enabled.value: c = self.BTCNSeq_conditions(dataframe) if c: conditions.append(reduce(lambda x, y: x & y, c)) if self.buy_btcjump_enabled.value: c = self.BTCJump_conditions(dataframe) if c: conditions.append(reduce(lambda x, y: x & y, c)) # OR them together if conditions: dataframe.loc[reduce(lambda x, y: x | y, conditions), 'buy'] = 1 return dataframe def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: """ Based on TA indicators, populates the sell signal for the given dataframe :param dataframe: DataFrame :return: DataFrame with buy column """ # Don't sell (have to set something in 'sell' column) dataframe.loc[(dataframe['close'] >= 0), 'sell'] = 0 return dataframe |
Strategy League — fixed backtest that feeds the ranking
The fixed-params backtest (33 pairs · 20210101-20260101) — the only run that feeds the Strategy League ranking.
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
Static source analysis — instant, does not run the strategy. Flags future-data leaks, backtest-realism problems, and indicators worth a second look.
Lookahead analysis
freqtrade lookahead-analysis: detects strategies peeking at future candles.