EMA and Bollinger Band Filters for Avoiding Pump Conditions
Summary
This short-term long-only strategy seeks entries after a pronounced decline, using several conditions together. On a five-minute timeframe, it requires closing price to be below the five- and twelve-period EMAs, at the twelve-period rolling low, and at or below the lower Bollinger Band. It also checks that current volume is below a threshold based on the prior 30 bars’ average volume. The stated intent is to avoid pump-and-dump conditions, although the entry rules themselves identify low-price, low-relative-volume conditions rather than defining a general pump detector.
An exit requires price to rise above both EMAs, reach the twelve-period rolling high, and meet or exceed the upper Bollinger Band. The code specifies a 5% stop loss and a 10% minimum ROI setting. No backtest window, market, performance results, or evidence that the filters avoid pump losses is provided. The source therefore communicates a specific indicator-based entry and exit recipe, but its effectiveness and applicability across assets remain unestablished.
Key ideas
- The strategy looks for long entries when price is below short and medium EMAs, at a rolling low, and near or below the lower Bollinger Band.
- The entry also requires volume below a threshold tied to the prior 30 bars’ average.
- An exit combines price above both EMAs, a rolling high, and the upper Bollinger Band.
- The code specifies a five-minute timeframe, a 5% stop loss, and a 10% minimum ROI setting.
- No backtest results are supplied to establish the strategy’s performance or pump avoidance.
Tags
Full text
# EMASkipPump
# EMASkipPump
basic strategy, which trys to avoid pump and dump market conditions. Shared from the tradingview
slack
## Source (GPL-3.0)
```python
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
import numpy # noqa
class EMASkipPump(IStrategy):
"""
basic strategy, which trys to avoid pump and dump market conditions. Shared from the tradingview
slack
"""
INTERFACE_VERSION: int = 3
EMA_SHORT_TERM = 5
EMA_MEDIUM_TERM = 12
EMA_LONG_TERM = 21
# Minimal ROI designed for the strategy.
# we only sell after 100%, unless our sell points are found before
minimal_roi = {
"0": 0.1
}
# Optimal stoploss designed for the strategy
# This attribute will be overridden if the config file contains "stoploss"
# should be converted to a trailing stop loss
stoploss = -0.05
# Optimal timeframe for the strategy
timeframe = '5m'
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
""" Adds several different TA indicators to the given DataFrame
"""
dataframe['ema_{}'.format(self.EMA_SHORT_TERM)] = ta.EMA(
dataframe, timeperiod=self.EMA_SHORT_TERM
)
dataframe['ema_{}'.format(self.EMA_MEDIUM_TERM)] = ta.EMA(
dataframe, timeperiod=self.EMA_MEDIUM_TERM
)
dataframe['ema_{}'.format(self.EMA_LONG_TERM)] = ta.EMA(
dataframe, timeperiod=self.EMA_LONG_TERM
)
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['min'] = ta.MIN(dataframe, timeperiod=self.EMA_MEDIUM_TERM)
dataframe['max'] = ta.MAX(dataframe, timeperiod=self.EMA_MEDIUM_TERM)
return dataframe
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(dataframe['volume'] < (dataframe['volume'].rolling(window=30).mean().shift(1) * 20)) &
(dataframe['close'] < dataframe['ema_{}'.format(self.EMA_SHORT_TERM)]) &
(dataframe['close'] < dataframe['ema_{}'.format(self.EMA_MEDIUM_TERM)]) &
(dataframe['close'] == dataframe['min']) &
(dataframe['close'] <= dataframe['bb_lowerband']),
'enter_long'
] = 1
return dataframe
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(dataframe['close'] > dataframe['ema_{}'.format(self.EMA_SHORT_TERM)]) &
(dataframe['close'] > dataframe['ema_{}'.format(self.EMA_MEDIUM_TERM)]) &
(dataframe['close'] >= dataframe['max']) &
(dataframe['close'] >= dataframe['bb_upperband']),
'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.