BollingerBandDipStrategy
♡
Basics
mode: spot
timeframe: 3m
interface version: 3
Settings
stoploss: -0.99
has minimal roi
trailing
protections
hyperopt
hyperopt params: 4
Indicators
Bollinger_Bands
DEMA
EMA
MACD
RSI
talib
Concepts
risk_management
trailing
Methods
leverage
protections
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 | from datetime import datetime from typing import Optional import freqtrade.vendor.qtpylib.indicators as qtpylib from freqtrade.strategy import IStrategy, merge_informative_pair, IntParameter from pandas import DataFrame import talib.abstract as ta bb_color = 'rgba(255,76,46,0.2)' class BollingerBandDipStrategy(IStrategy): INTERFACE_VERSION = 3 # Strategy parameters timeframe = '3m' informative_timeframe = '4h' buy_params = { "leverage_amount": 10, "percent_below_lowerband": 22, "rsi_down": 20, } sell_params = { "rsi_up": 70, } minimal_roi = { "0": 1.5, } # Stoploss: stoploss = -0.99 # value loaded from strategy use_custom_stoploss = False # Trailing stop: trailing_stop = True # Enable trailing stop trailing_stop_positive = 0.99 trailing_stop_positive_offset = 1.0 trailing_only_offset_is_reached = True # Ensure trailing stop only activates after offset is reached # Percentage below lowerband percent_below_lowerband = IntParameter(10, 20, default=16, space="buy") leverage_amount = IntParameter(1, 15, default=5, space="buy") rsi_down = IntParameter(15, 45, default=30, space="buy") rsi_up = IntParameter(65, 95, default=70, space="sell") # Bollinger Bands parameters bb_length = 10 bb_stddev = 1.8 plot_config = { 'main_plot': { 'bb_threshold': {'color': 'orange'}, 'bb_lowerband_4h': {'color': bb_color}, 'bb_upperband_4h': { 'color': bb_color, 'fill_to': 'bb_lowerband_4h', 'fill_label': 'Bollinger Band 4h', 'fill_color': bb_color, }, }, 'subplots': { 'RSI': { 'rsi_mid': {'color': 'purple'}, 'rsi_up': {'color': 'green'}, 'rsi_down': {'color': 'red'}, 'rsi': {'color': 'blue'}, 'rsi_ema': {'color': 'grey'}, }, }, } @property def protections(self): return [ { "method": "StoplossGuard", "lookback_period_candles": 500, "trade_limit": 1, "stop_duration_candles": 1000, "only_per_pair": True, "only_per_side": False } ] def informative_pairs(self): pairs = self.dp.current_whitelist() informative_pairs = [(pair, self.informative_timeframe) for pair in pairs] return informative_pairs def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: """ Populate indicators for Bollinger Bands strategy """ if not self.dp: # Don't do anything if DataProvider is not available. return dataframe informative = self.dp.get_pair_dataframe(pair=metadata['pair'], timeframe=self.informative_timeframe) bollinger_4h = ta.BBANDS( informative, timeperiod=self.bb_length, nbdevup=self.bb_stddev, nbdevdn=self.bb_stddev ) # Add Bollinger Bands to the 4h informative dataframe informative['bb_lowerband'] = bollinger_4h['lowerband'] informative['bb_middleband'] = bollinger_4h['middleband'] informative['bb_upperband'] = bollinger_4h['upperband'] for val in self.percent_below_lowerband.range: informative[f'bb_threshold_{val}'] = bollinger_4h['lowerband'].mul( (100 - self.percent_below_lowerband.value) / 100) dataframe = merge_informative_pair(dataframe, informative, self.timeframe, self.informative_timeframe, ffill=True) dataframe['dema'] = ta.DEMA(dataframe, timeperiod=3, price='low') dataframe['bb_threshold'] = dataframe[f'bb_threshold_{self.percent_below_lowerband.value}_4h'] dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14) dataframe['rsi_mid'] = 50 dataframe['rsi_up'] = self.rsi_up.value dataframe['rsi_down'] = self.rsi_down.value dataframe['rsi_ema'] = ta.EMA(dataframe['rsi'], timeperiod=3) # Calculate MACD macd = ta.MACD(dataframe, fastperiod=12, slowperiod=26, signalperiod=9) dataframe['macd'] = macd['macd'] dataframe['macdsignal'] = macd['macdsignal'] dataframe['macdhist'] = macd['macdhist'] dataframe['dema_cross_above_bb_threshold'] = qtpylib.crossed_above(dataframe['dema'], dataframe['bb_threshold']) dataframe['rsi_ema_cross_above_down'] = qtpylib.crossed_above(dataframe['rsi_ema'], dataframe['rsi_down']) dataframe['rsi_ema_cross_above_up'] = qtpylib.crossed_above(dataframe['rsi_ema'], dataframe['rsi_up']) dataframe['rsi_cross_above_down'] = qtpylib.crossed_above(dataframe['rsi'], dataframe['rsi_down']) dataframe['rsi_cross_below_down'] = qtpylib.crossed_below(dataframe['rsi'], dataframe['rsi_down']) dataframe['rsi_cross_above_up'] = qtpylib.crossed_above(dataframe['rsi'], dataframe['rsi_up']) # dataframe['rsi_cross_below_up'] = qtpylib.crossed_below(dataframe['rsi'], dataframe['rsi_up']) return dataframe def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: """ Define entry conditions for long positions """ dataframe.loc[ (dataframe['rsi_cross_above_down'] == True) & (dataframe['dema'] < dataframe['bb_threshold']), 'enter_long'] = 1 return dataframe def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: """ Define exit conditions for long positions """ dataframe.loc[ dataframe['rsi_cross_above_up'] == True, 'exit_long'] = 1 return dataframe def leverage( self, pair: str, current_time: datetime, current_rate: float, proposed_leverage: float, max_leverage: float, entry_tag: Optional[str], side: str, **kwargs, ) -> float: """ Calculate leverage based on the provided settings """ return self.leverage_amount.value |
Strategy League — fixed backtest that feeds the ranking
Failed — sandbox ran out of memory (OOM-killed, SANDBOX_MEMORY=20g)
:27:12,471 - freqtrade.data.dataprovider - INFO - Loading data for OP/USDT 4h from 2021-01-01 00:00:00 to 2026-01-01 00:00:00 2026-07-27 03:27:12,475 - freqtrade.data.history.datahandlers.idatahandler - WARNING - OP/USDT, spot, 4h, data starts at 2022-06-01 08:00:00 2026-07-27 03:27:12,648 - freqtrade.data.dataprovider - INFO - Loading data for AAVE/USDT 4h from 2021-01-01 00:00:00 to 2026-01-01 00:00:00 2026-07-27 03:27:12,878 - freqtrade.data.dataprovider - INFO - Loading data for INJ/USDT 4h from 2021-01-01 00:00:00 to 2026-01-01 00:00:00 2026-07-27 03:27:13,123 - freqtrade.data.dataprovider - INFO - Loading data for CRV/USDT 4h from 2021-01-01 00:00:00 to 2026-01-01 00:00:00 2026-07-27 03:27:13,353 - freqtrade.data.dataprovider - INFO - Loading data for SNX/USDT 4h from 2021-01-01 00:00:00 to 2026-01-01 00:00:00 2026-07-27 03:27:13,578 - freqtrade.data.dataprovider - INFO - Loading data for COMP/USDT 4h from 2021-01-01 00:00:00 to 2026-01-01 00:00:00 2026-07-27 03:27:13,795 - freqtrade.data.dataprovider - INFO - Loading data for SUI/USDT 4h from 2021-01-01 00:00:00 to 2026-01-01 00:00:00 2026-07-27 03:27:13,800 - freqtrade.data.history.datahandlers.idatahandler - WARNING - SUI/USDT, spot, 4h, data starts at 2023-05-03 12:00:00 2026-07-27 03:27:13,935 - freqtrade.data.dataprovider - INFO - Loading data for NEAR/USDT 4h from 2021-01-01 00:00:00 to 2026-01-01 00:00:00 2026-07-27 03:27:14,150 - freqtrade.data.dataprovider - INFO - Loading data for SEI/USDT 4h from 2021-01-01 00:00:00 to 2026-01-01 00:00:00 2026-07-27 03:27:14,154 - freqtrade.data.history.datahandlers.idatahandler - WARNING - SEI/USDT, spot, 4h, data starts at 2023-08-15 12:00:00 2026-07-27 03:27:14,506 - freqtrade.optimize.backtesting - INFO - Backtesting with data from 2021-01-01 00:00:00 up to 2026-01-01 00:00:00 (1826 days). 2026-07-27 03:27:14,508 - freqtrade.resolvers.iresolver - INFO - Using resolved protection StoplossGuard from '/freqtrade/freqtrade/plugins/protections/stoploss_guard.py'...
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.