BinHV45: One-Minute Bollinger Band Reversal Entries
Summary
This Freqtrade strategy uses a 40-period Bollinger Band on one-minute candles to identify potential long entries after price falls below the prior lower band. It also requires a sufficiently wide band, a large close-to-close move, a small lower tail relative to band width, and a non-rising close. These conditions seek a sharp downside move that may be nearing exhaustion.
The strategy sets a 1.25% minimal ROI and a 5% stop loss. It defines no indicator-based exit signal, so exits rely on the ROI and stop-loss settings. The source gives the entry rules and configured values, but no performance results, asset universe, or validation evidence. Its parameters are intended for optimization, although the declared parameter ranges and defaults appear inconsistent with the listed configured values. The rules describe a long-only setup and do not establish that it is profitable or robust across markets.
Key ideas
- The strategy checks whether the close has fallen below the previous candle’s lower Bollinger Band.
- It filters entries using band width, close movement, lower-tail size, and close direction.
- The Bollinger calculation uses a 40-candle window with two standard deviations.
- The strategy has a 1.25% ROI target and a 5% stop loss, with no separate exit signal.
Tags
Full text
# BinHV45
# BinHV45
## Source (GPL-3.0)
```python
# --- Do not remove these libs ---
from freqtrade.strategy import IStrategy
from freqtrade.strategy import IntParameter
from pandas import DataFrame
import numpy as np
# --------------------------------
import talib.abstract as ta
import freqtrade.vendor.qtpylib.indicators as qtpylib
def bollinger_bands(stock_price, window_size, num_of_std):
rolling_mean = stock_price.rolling(window=window_size).mean()
rolling_std = stock_price.rolling(window=window_size).std()
lower_band = rolling_mean - (rolling_std * num_of_std)
return rolling_mean, lower_band
class BinHV45(IStrategy):
INTERFACE_VERSION: int = 3
minimal_roi = {
"0": 0.0125
}
stoploss = -0.05
timeframe = '1m'
buy_bbdelta = IntParameter(low=1, high=15, default=30, space='buy', optimize=True)
buy_closedelta = IntParameter(low=15, high=20, default=30, space='buy', optimize=True)
buy_tail = IntParameter(low=20, high=30, default=30, space='buy', optimize=True)
# Hyperopt parameters
buy_params = {
"buy_bbdelta": 7,
"buy_closedelta": 17,
"buy_tail": 25,
}
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
bollinger = qtpylib.bollinger_bands(dataframe['close'], window=40, stds=2)
dataframe['upper'] = bollinger['upper']
dataframe['mid'] = bollinger['mid']
dataframe['lower'] = bollinger['lower']
dataframe['bbdelta'] = (dataframe['mid'] - dataframe['lower']).abs()
dataframe['pricedelta'] = (dataframe['open'] - dataframe['close']).abs()
dataframe['closedelta'] = (dataframe['close'] - dataframe['close'].shift()).abs()
dataframe['tail'] = (dataframe['close'] - dataframe['low']).abs()
return dataframe
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(
dataframe['lower'].shift().gt(0) &
dataframe['bbdelta'].gt(dataframe['close'] * self.buy_bbdelta.value / 1000) &
dataframe['closedelta'].gt(dataframe['close'] * self.buy_closedelta.value / 1000) &
dataframe['tail'].lt(dataframe['bbdelta'] * self.buy_tail.value / 1000) &
dataframe['close'].lt(dataframe['lower'].shift()) &
dataframe['close'].le(dataframe['close'].shift())
),
'enter_long'] = 1
return dataframe
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
"""
no sell signal
"""
dataframe.loc[:, 'exit_long'] = 0
return dataframe
```Shown in full with attribution under the source's licence. Licence: GPL-3.0
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.