CombinedBinHAndClucHyperV3
♡
Basics
mode: spot
timeframe: 1m
interface version: 3
outdated
Settings
stoploss: -0.06
has minimal roi
trailing
custom stoploss
hyperopt
hyperopt params: 14
Indicators
ATR
Bollinger_Bands
EMA
talib
Concepts
trailing
Methods
custom_stoploss
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 | # --- Do not remove these libs --- import freqtrade.vendor.qtpylib.indicators as qtpylib import numpy as np # -------------------------------- import talib.abstract as ta from freqtrade.strategy.interface import IStrategy from freqtrade.strategy import CategoricalParameter, DecimalParameter, IntParameter from abc import ABC, abstractmethod from pandas import DataFrame from freqtrade.persistence import Trade from freqtrade.exchange import timeframe_to_prev_date, timeframe_to_seconds from datetime import datetime, timedelta import math class CombinedBinHAndClucHyperV3(IStrategy): INTERFACE_VERSION = 3 # Based on a backtesting: # - the best perfomance is reached with "max_open_trades" = 2 (in average for any market), # so it is better to increase "stake_amount" value rather then "max_open_trades" to get more profit # - if the market is constantly green(like in JAN 2018) the best performance is reached with # "max_open_trades" = 2 and minimal_roi = 0.01 timeframe = '1m' use_sell_signal = True sell_profit_only = False ignore_roi_if_buy_signal = False # ---------------------------------------------------------------- # Hyper Params # # Buy buy_a_time_window = IntParameter(40, 100, default=30) buy_a_atr_window = IntParameter(10, 300, default=14) buy_a_bbdelta_rate = DecimalParameter(0.004, 0.02, default=0.016, decimals=3) buy_a_closedelta_rate = DecimalParameter(0.000, 0.020, default=0.0087, decimals=4) buy_a_tail_rate = DecimalParameter(0.12, 1, default=0.28, decimals=2) buy_a_min_sell_rate = DecimalParameter(1.004, 1.1, default=1.03, decimals=3) buy_a_atr_rate = DecimalParameter(0.00, 3.00, default=1, decimals=2) buy_b_close_rate = DecimalParameter(0.4, 1.8, default=0.979, decimals=3) buy_b_volume_mean_slow_window = IntParameter(100, 300, default=30) buy_b_ema_slow = IntParameter(40, 100, default=50) buy_b_time_window = IntParameter(100, 300, default=20) buy_b_volume_mean_slow_num = IntParameter(10, 100, default=20) # Sell sell_bb_mid_slow_window = IntParameter(10, 100, default=91) sell_trailing_stop_positive_offset = DecimalParameter(0.01, 0.03, default=0.012, decimals=3) sell_trailing_stop_positive = 0.001 # ---------------------------------------------------------------- # Buy hyperspace params: buy_params = { 'buy_a_closedelta_rate': 0.004, 'buy_a_time_window': 21, 'buy_a_atr_window': 14, "buy_a_atr_rate": 0.26, "buy_a_bbdelta_rate": 0.014, "buy_a_min_sell_rate": 1.062, "buy_a_tail_rate": 0.47, 'buy_b_close_rate': 0.979, 'buy_b_time_window': 20, 'buy_b_ema_slow': 50, 'buy_b_volume_mean_slow_num': 20, 'buy_b_volume_mean_slow_window': 30, } # Sell hyperspace params: sell_params = { 'sell_bb_mid_slow_window': 91, "sell_trailing_stop_positive_offset": 0.014, } # ROI table: minimal_roi = { "0": 3, } # Stoploss: stoploss = -0.06 trailing_stop = False trailing_only_offset_is_reached = False use_custom_stoploss = True def custom_stoploss(self, pair: str, trade: 'Trade', current_time: datetime, current_rate: float, current_profit: float, **kwargs) -> float: sell_trailing_stop_positive_offset = self.sell_trailing_stop_positive_offset.value if isinstance(self.sell_trailing_stop_positive_offset, ABC) else self.sell_trailing_stop_positive_offset sell_trailing_stop_positive = self.sell_trailing_stop_positive.value if isinstance(self.sell_trailing_stop_positive, ABC) else self.sell_trailing_stop_positive dataframe, _ = self.dp.get_analyzed_dataframe(pair, self.timeframe) last_candle = dataframe.iloc[-1].squeeze() if last_candle is None: return -1 trade_date = timeframe_to_prev_date(self.timeframe, trade.open_date_utc - timedelta(seconds=timeframe_to_seconds(self.timeframe))) trade_candle = dataframe.loc[dataframe['date'] == trade_date] if trade_candle.empty: return -1 trade_candle = trade_candle.squeeze() slippage_ratio = trade.open_rate / trade_candle['close'] - 1 slippage_ratio = slippage_ratio if slippage_ratio > 0 else 0 current_profit_comp = current_profit + slippage_ratio if current_profit_comp < sell_trailing_stop_positive_offset: return -1 else: return sell_trailing_stop_positive def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: # strategy BinHV45 for x in self.buy_a_time_window.range if isinstance(self.buy_a_time_window, ABC) else [self.buy_a_time_window]: buy_bollinger = qtpylib.bollinger_bands(dataframe['close'], window=x, stds=2) dataframe[f'lower_{x}'] = buy_bollinger['lower'] dataframe[f'bbdelta_{x}'] = (buy_bollinger['mid'] - dataframe[f'lower_{x}']).abs() dataframe[f'closedelta_{x}'] = (dataframe['close'] - dataframe['close'].shift()).abs() dataframe[f'tail_{x}'] = (dataframe['close'] - dataframe['low']).abs() # strategy ClucMay72018 for x in self.buy_b_time_window.range if isinstance(self.buy_b_time_window, ABC) else [self.buy_b_time_window]: bollinger = qtpylib.bollinger_bands(qtpylib.typical_price(dataframe), window=x, stds=2) dataframe[f'bb_typical_lower_{x}'] = bollinger['lower'] for x in self.buy_b_ema_slow.range if isinstance(self.buy_b_ema_slow, ABC) else [self.buy_b_ema_slow]: dataframe[f'ema_slow_{x}'] = ta.EMA(dataframe, timeperiod=x) for x in self.buy_b_volume_mean_slow_window.range if isinstance(self.buy_b_volume_mean_slow_window, ABC) else [self.buy_b_volume_mean_slow_window]: dataframe[f'volume_mean_slow_{x}'] = dataframe['volume'].rolling(window=x).mean() for x in self.sell_bb_mid_slow_window.range if isinstance(self.sell_bb_mid_slow_window, ABC) else [self.sell_bb_mid_slow_window]: sell_bollinger = qtpylib.bollinger_bands(qtpylib.typical_price(dataframe), window=x, stds=2) dataframe[f'bb_typical_mid_{x}'] = sell_bollinger['mid'] for x in self.buy_a_atr_window.range if isinstance(self.buy_a_atr_window, ABC) else [self.buy_a_atr_window]: dataframe[f'atr_rate_{x}'] = ta.ATR(dataframe, timeperiod=x) / dataframe['close'] return dataframe def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: buy_a_time_window = self.buy_a_time_window.value if isinstance(self.buy_a_time_window, ABC) else self.buy_a_time_window buy_a_bbdelta_rate = self.buy_a_bbdelta_rate.value if isinstance(self.buy_a_bbdelta_rate, ABC) else self.buy_a_bbdelta_rate buy_a_closedelta_rate = self.buy_a_closedelta_rate.value if isinstance(self.buy_a_closedelta_rate, ABC) else self.buy_a_closedelta_rate buy_a_tail_rate = self.buy_a_tail_rate.value if isinstance(self.buy_a_tail_rate, ABC) else self.buy_a_tail_rate buy_a_min_sell_rate = self.buy_a_min_sell_rate.value if isinstance(self.buy_a_min_sell_rate, ABC) else self.buy_a_min_sell_rate buy_a_atr_rate = self.buy_a_atr_rate.value if isinstance(self.buy_a_atr_rate, ABC) else self.buy_a_atr_rate buy_a_atr_window = self.buy_a_atr_window.value if isinstance(self.buy_a_atr_window, ABC) else self.buy_a_atr_window buy_b_ema_slow = self.buy_b_ema_slow.value if isinstance(self.buy_b_ema_slow, ABC) else self.buy_b_ema_slow buy_b_close_rate = self.buy_b_close_rate.value if isinstance(self.buy_b_close_rate, ABC) else self.buy_b_close_rate buy_b_time_window = self.buy_b_time_window.value if isinstance(self.buy_b_time_window, ABC) else self.buy_b_time_window buy_b_volume_mean_slow_window = self.buy_b_volume_mean_slow_window.value if isinstance(self.buy_b_volume_mean_slow_window, ABC) else self.buy_b_volume_mean_slow_window buy_b_volume_mean_slow_num = self.buy_b_volume_mean_slow_num.value if isinstance(self.buy_b_volume_mean_slow_num, ABC) else self.buy_b_volume_mean_slow_num sell_bb_mid_slow_window = self.sell_bb_mid_slow_window.value if isinstance(self.sell_bb_mid_slow_window, ABC) else self.sell_bb_mid_slow_window dataframe.loc[ ( # strategy BinHV45 dataframe[f'lower_{buy_a_time_window}'].shift().gt(0) & dataframe[f'bbdelta_{buy_a_time_window}'].gt(dataframe['close'] * buy_a_bbdelta_rate) & dataframe[f'closedelta_{buy_a_time_window}'].gt(dataframe['close'] * buy_a_closedelta_rate) & dataframe[f'tail_{buy_a_time_window}'].lt(dataframe[f'bbdelta_{buy_a_time_window}'] * buy_a_tail_rate) & dataframe['close'].lt(dataframe[f'lower_{buy_a_time_window}'].shift()) & dataframe['close'].le(dataframe['close'].shift()) & dataframe[f'bb_typical_mid_{sell_bb_mid_slow_window}'].gt(dataframe['close'] * (buy_a_min_sell_rate + dataframe[f'atr_rate_{buy_a_atr_window}'] * buy_a_atr_rate)) ) | ( # strategy ClucMay72018 (dataframe['close'] < dataframe[f'ema_slow_{buy_b_ema_slow}']) & (dataframe['close'] < buy_b_close_rate * dataframe[f'bb_typical_lower_{buy_b_time_window}']) & (dataframe['volume'] < (dataframe[f'volume_mean_slow_{buy_b_volume_mean_slow_window}'].shift(1) * buy_b_volume_mean_slow_num)) ) , 'buy' ] = 1 return dataframe def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: sell_bb_mid_slow_window = self.sell_bb_mid_slow_window.value if isinstance(self.sell_bb_mid_slow_window, ABC) else self.sell_bb_mid_slow_window dataframe.loc[(dataframe['close'] > dataframe[f'bb_typical_mid_{sell_bb_mid_slow_window}']), 'sell'] = 1 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.