BollingerBandStrategy
♡
Basics
mode: spot
timeframe: 3m
Settings
stoploss: -0.1
has minimal roi
trailing
Indicators
Bollinger_Bands
talib
Concepts
trailing
Methods
intraday_intensity_index
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 | from pandas import DataFrame from functools import reduce from freqtrade.strategy import IStrategy from freqtrade.exchange import timeframe_to_minutes import logging import talib.abstract as ta class BollingerBandStrategy(IStrategy): timeframe = "3m" timeframe_mins = timeframe_to_minutes(timeframe) # ROI table: minimal_roi = { "0": 0.242, str(timeframe_mins * 3): 0.01, # 2% after 3 candles str(timeframe_mins * 6): 0.00 # 1% After 6 candles } # Stoploss: stoploss = -0.1 # Trailing stop: trailing_stop = True trailing_stop_positive = 0.01 trailing_stop_positive_offset = 0.05 trailing_only_offset_is_reached = False def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: logging.info(dataframe['date']) upperband, middleband, lowerband = ta.BBANDS( dataframe['close'], timeperiod=20 ) dataframe['upperband'] = upperband dataframe['middleband'] = middleband dataframe['lowerband'] = lowerband dataframe['iii'] = self.intraday_intensity_index(dataframe) dataframe['money_flow'] = dataframe['iii'].rolling(window=21).sum() / dataframe['close'].rolling(window=21).sum() return dataframe def intraday_intensity_index(self, dataframe): close = dataframe['close'] high = dataframe['high'] low = dataframe['low'] volume = dataframe['volume'] return ( (close * 2) - high - low ) / ( (high - low) ) * volume def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: conditions_long = [] conditions_short = [] conditions_long.append( dataframe['close'] < dataframe['lowerband'] ) conditions_long.append( (dataframe['volume'] > 0) ) conditions_long.append( (dataframe['money_flow'] > 0) ) conditions_long.append( (dataframe['iii'] > 0) ) conditions_short.append( dataframe['close'] > dataframe['upperband'] ) conditions_short.append( (dataframe['money_flow'] < 0) ) conditions_short.append( (dataframe['volume'] > 0) ) conditions_short.append( (dataframe['iii'] < 0) ) dataframe.loc[ ( reduce(lambda x, y: x & y, conditions_long) ), 'enter_long'] = 1 dataframe.loc[ ( reduce(lambda x, y: x & y, conditions_short) ), 'enter_short'] = 1 return dataframe def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame: return super().populate_exit_trend(dataframe, metadata) |
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.