Skip to content
All library documents

ClucMay72018: Oversold Bollinger Band Entries and Mean Reversion

Article Strategy library · Author: berlinguyinca

Summary

This five-minute crypto strategy looks for long entries when price is below a 50-period exponential moving average and closes materially below the lower band of a 20-period Bollinger calculation. It also checks that current volume remains below a threshold based on the previous 30 candles' average volume. The exit condition is a close above the Bollinger middle band, framing the setup as a potential rebound toward the recent average.

The implementation calculates RSI and its EMA, MACD, and ADX as well, but the shown entry and exit rules do not use those values. It specifies a one-percent minimal return target and a five-percent stop loss, subject to configuration overrides. The document supplies code rather than backtest results, so it does not establish profitability, drawdown, or robustness. Its entry conditions combine a downtrend filter with an oversold price condition, and testing would be needed to assess sensitivity to market, fees, and parameter choices.

Key ideas

  • Long entries require price below the 50-period EMA and below a threshold relative to the lower Bollinger band.
  • The volume condition compares current volume with a shifted rolling average of prior volume.
  • The strategy exits when price closes above the Bollinger middle band.
  • RSI, RSI EMA, MACD, and ADX are calculated but do not appear in the displayed entry or exit rules.
  • The document provides strategy parameters and code but no performance results.

Tags

Full text
# ClucMay72018


# ClucMay72018









author@: Gert Wohlgemuth

    works on new objectify branch!

## Source (GPL-3.0)

```python
# --- Do not remove these libs ---
from freqtrade.strategy 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
from typing import Dict, List
from functools import reduce
from pandas import DataFrame, DatetimeIndex, merge
# --------------------------------

import talib.abstract as ta
import freqtrade.vendor.qtpylib.indicators as qtpylib
import numpy  # noqa


class ClucMay72018(IStrategy):
    """

    author@: Gert Wohlgemuth

    works on new objectify branch!

    """

    INTERFACE_VERSION: int = 3
    # Minimal ROI designed for the strategy.
    # This attribute will be overridden if the config file contains "minimal_roi"
    minimal_roi = {
        "0": 0.01
    }

    # Optimal stoploss designed for the strategy
    # This attribute will be overridden if the config file contains "stoploss"
    stoploss = -0.05

    # Optimal timeframe for the strategy
    timeframe = '5m'

    def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        dataframe['rsi'] = ta.RSI(dataframe, timeperiod=5)
        rsiframe = DataFrame(dataframe['rsi']).rename(columns={'rsi': 'close'})
        dataframe['emarsi'] = ta.EMA(rsiframe, timeperiod=5)
        macd = ta.MACD(dataframe)
        dataframe['macd'] = macd['macd']
        dataframe['adx'] = ta.ADX(dataframe)
        bollinger = qtpylib.bollinger_bands(qtpylib.typical_price(dataframe), window=20, stds=2)
        dataframe['bb_lowerband'] = bollinger['lower']
        dataframe['bb_middleband'] = bollinger['mid']
        dataframe['bb_upperband'] = bollinger['upper']
        dataframe['ema100'] = ta.EMA(dataframe, timeperiod=50)
        return dataframe

    def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
        """
        Based on TA indicators, populates the buy signal for the given dataframe
        :param dataframe: DataFrame
        :return: DataFrame with buy column
        """
        dataframe.loc[
            (
                    (dataframe['close'] < dataframe['ema100']) &
                    (dataframe['close'] < 0.985 * dataframe['bb_lowerband']) &
                    (dataframe['volume'] < (dataframe['volume'].rolling(window=30).mean().shift(1) * 20))
            ),
            'enter_long'] = 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
        """
        dataframe.loc[
            (
                (dataframe['close'] > dataframe['bb_middleband'])
            ),
            'exit_long'] = 1
        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.